用户/邮箱登录
parent
94d0c44100
commit
b7f8779e21
|
@ -67,7 +67,10 @@ public class SysLoginService {
|
|||
// 查询用户信息
|
||||
Result<LoginUser> userResult = remoteUserService.getUserInfo(username, SecurityConstants.INNER);
|
||||
|
||||
if (StringUtils.isNull(userResult) || StringUtils.isNull(userResult.getData())) {
|
||||
if ((StringUtils.isNull(userResult) || StringUtils.isNull(userResult.getData()))&& username.contains ( "@" )) {
|
||||
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "登录邮箱不存在");
|
||||
throw new ServiceException("登录邮箱:" + username + " 不存在");
|
||||
}else if ((StringUtils.isNull(userResult) || StringUtils.isNull(userResult.getData()))){
|
||||
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "登录用户不存在");
|
||||
throw new ServiceException("登录用户:" + username + " 不存在");
|
||||
}
|
||||
|
|
|
@ -100,7 +100,10 @@ public class SysUserController extends BaseController {
|
|||
@GetMapping("/info/{username}")
|
||||
public Result<LoginUser> info (@PathVariable("username") String username) {
|
||||
SysUser sysUser = userService.selectUserByUserName(username);
|
||||
if (StringUtils.isNull(sysUser)) {
|
||||
if (StringUtils.isNull(sysUser) && username.contains ( "@" )) {
|
||||
return Result.error("邮箱或密码错误");
|
||||
}
|
||||
else if (StringUtils.isNull(sysUser)){
|
||||
return Result.error("用户名或密码错误");
|
||||
}
|
||||
// 角色集合
|
||||
|
|
|
@ -152,7 +152,7 @@
|
|||
|
||||
<select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult">
|
||||
<include refid="selectUserVo"/>
|
||||
where u.user_name = #{userName} and u.del_flag = '0'
|
||||
where u.user_name or u.email =#{userName} and u.del_flag = '0'
|
||||
</select>
|
||||
|
||||
<select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
|
||||
|
|
Loading…
Reference in New Issue