邮箱登入
This commit is contained in:
parent
30c0612c51
commit
155ff74c57
|
@ -68,10 +68,15 @@ public class ShiroDBRealm extends AuthorizingRealm {
|
|||
UserDTO user = userService.getUserDTO(userId);
|
||||
String msg;
|
||||
if (user == null) {
|
||||
msg = "The user does not exist: " + userId;
|
||||
logger.warn(msg);
|
||||
throw new UnknownAccountException(Translator.get("user_not_exist") + userId);
|
||||
user = userService.getUserDTOByEmail(userId);
|
||||
if (user == null) {
|
||||
msg = "The user does not exist: " + userId;
|
||||
logger.warn(msg);
|
||||
throw new UnknownAccountException(Translator.get("user_not_exist") + userId);
|
||||
}
|
||||
userId = user.getId();
|
||||
}
|
||||
|
||||
// local test
|
||||
if (StringUtils.equals("local", runMode)) {
|
||||
SessionUser sessionUser = SessionUser.fromUser(user);
|
||||
|
|
|
@ -147,6 +147,16 @@ public class UserService {
|
|||
return userDTO;
|
||||
}
|
||||
|
||||
public UserDTO getUserDTOByEmail(String email) {
|
||||
UserExample example = new UserExample();
|
||||
example.createCriteria().andEmailEqualTo(email);
|
||||
List<User> users = userMapper.selectByExample(example);
|
||||
if (users == null || users.size() <= 0) {
|
||||
return null;
|
||||
}
|
||||
return getUserDTO(users.get(0).getId());
|
||||
}
|
||||
|
||||
public UserRoleDTO getUserRole(String userId) {
|
||||
UserRoleDTO userRoleDTO = new UserRoleDTO();
|
||||
//
|
||||
|
|
Loading…
Reference in New Issue