This commit is contained in:
wenyann 2020-06-04 15:19:10 +08:00
parent 93ddd15caf
commit 22ff5f0b4b
4 changed files with 22 additions and 10 deletions

View File

@ -1,9 +1,9 @@
package io.metersphere.controller;
import io.metersphere.base.domain.UserRole;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.controller.request.LoginRequest;
import io.metersphere.dto.UserDTO;
import io.metersphere.i18n.Translator;
import io.metersphere.service.UserService;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
@ -64,22 +64,22 @@ public class LoginController {
// 返回 userDTO
return ResultHolder.success(subject.getSession().getAttribute("user"));
} else {
return ResultHolder.error("login fail");
return ResultHolder.error(Translator.get("login_fail"));
}
} catch (ExcessiveAttemptsException e) {
msg = "excessive attempts";
msg = "excessive_attempts";
} catch (LockedAccountException e) {
msg = "the user has been locked.";
msg = "user_locked";
} catch (DisabledAccountException e) {
msg = "the user has been disabled. ";
msg = "user_has_been_disabled ";
} catch (ExpiredCredentialsException e) {
msg = "user expires. ";
msg = "user_expires. ";
} catch (AuthenticationException e) {
msg = e.getMessage();
} catch (UnauthorizedException e) {
msg = "not authorized. " + e.getMessage();
msg = "not_authorized" + e.getMessage();
}
return ResultHolder.error(msg);
return ResultHolder.error(Translator.get(msg));
}
@GetMapping(value = "/signout")

View File

@ -100,4 +100,8 @@ api_test_name_already_exists=Test name already exists
password_is_incorrect=Incorrect password
user_not_exist=user does not exist
user_has_been_disabled=the user has been disabled.
excessive_attempts=Excessive attempts
excessive_attempts=Excessive attempts
user_locked=the user has been locked.
user_expires=user expires.
not_authorized=not authorized.
login_fail=Login fail

View File

@ -103,5 +103,9 @@ password_is_incorrect=密码不正确
user_not_exist=用户不存在:
user_has_been_disabled=用户已被禁用
excessive_attempts=操作频繁
user_has_been_locked
user_locked=用户被锁定
user_expires=用户过期
not_authorized=未经授权

View File

@ -101,3 +101,7 @@ password_is_incorrect=密碼不正確
user_not_exist=用戶不存在:
user_has_been_disabled.=用戶已被禁用
excessive_attempts=操作頻繁
user_locked=用戶被鎖定
user_expires=用戶過期
not_authorized=未經授權。
login_fail=登入失敗