增加手机登录
This commit is contained in:
parent
08407ccbad
commit
594af39ec3
@ -216,4 +216,11 @@ public interface IUserBaseService {
|
||||
*/
|
||||
List<String> listUserIds(List<UserDTO> userDTOs);
|
||||
|
||||
/**
|
||||
* 通过手机获取用户
|
||||
*
|
||||
* @param phones
|
||||
* @return
|
||||
*/
|
||||
List<UserDTO> listByUserPhones(List<String> phones);
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import ink.wgink.pojo.bos.LoginUser;
|
||||
import ink.wgink.service.user.enums.UserStateEnum;
|
||||
import ink.wgink.service.user.pojo.pos.UserPO;
|
||||
import ink.wgink.service.user.service.IUserService;
|
||||
import ink.wgink.util.RegexUtil;
|
||||
import ink.wgink.util.date.DateUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.joda.time.DateTime;
|
||||
@ -48,8 +49,15 @@ public class UserDetailServiceImpl implements UserDetailsService, IUserDetailChe
|
||||
} catch (Exception e) {
|
||||
username = userInfo;
|
||||
}
|
||||
|
||||
UserPO userPO = userService.getPOByUsername(username.toLowerCase());
|
||||
// 通过用户名查询
|
||||
UserPO userPO;
|
||||
if (RegexUtil.isPhone(username.toLowerCase())) {
|
||||
// 手机登录
|
||||
userPO = userService.getPOByPhone(username.toLowerCase());
|
||||
} else {
|
||||
// 用户名登录
|
||||
userPO = userService.getPOByUsername(username.toLowerCase());
|
||||
}
|
||||
if (null == userPO) {
|
||||
throw new UserAuthenticationException("账号不存在");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user