Compare commits

...

2 Commits

Author SHA1 Message Date
15544878926 04639237e5 邮箱后段 2024-04-12 14:21:03 +08:00
15544878926 85f2bae937 邮箱后段 2024-04-12 14:19:52 +08:00
3 changed files with 8 additions and 7 deletions

View File

@ -44,19 +44,19 @@ public class SysLoginService {
// 用户名或密码为空 错误
if (StringUtils.isAnyBlank(username, password)) {
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "用户/密码必须填写");
throw new ServiceException("用户/密码必须填写");
throw new ServiceException("邮箱必须填写");
}
// 密码如果不在指定范围内 错误
if (password.length() < UserConstants.PASSWORD_MIN_LENGTH
|| password.length() > UserConstants.PASSWORD_MAX_LENGTH) {
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "用户密码不在指定范围");
throw new ServiceException("用户密码不在指定范围");
throw new ServiceException("邮箱范围");
}
// 用户名不在指定范围内 错误
if (username.length() < UserConstants.USERNAME_MIN_LENGTH
|| username.length() > UserConstants.USERNAME_MAX_LENGTH) {
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "用户名不在指定范围");
throw new ServiceException("用户名不在指定范围");
throw new ServiceException("邮箱范围");
}
// IP黑名单校验
String blackStr = Convert.toStr(redisService.getCacheObject(CacheConstants.SYS_LOGIN_BLACKIPLIST));
@ -80,11 +80,11 @@ public class SysLoginService {
SysUser user = userResult.getData().getSysUser();
if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) {
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "对不起,您的账号已被删除");
throw new ServiceException("对不起,您的账号" + username + " 已被删除");
throw new ServiceException("对不起,您的邮箱" + username + " 已被删除");
}
if (UserStatus.DISABLE.getCode().equals(user.getStatus())) {
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "用户已停用,请联系管理员");
throw new ServiceException("对不起,您的账号" + username + " 已停用");
throw new ServiceException("对不起,您的邮箱" + username + " 已停用");
}
passwordService.validate(user, password);
recordLogService.recordLogininfor(username, Constants.LOGIN_SUCCESS, "登录成功");

View File

@ -46,7 +46,7 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
*
* @return
*/
public SysUser selectUserByUserName (String userName);
public SysUser selectUserByUserName (@Param("userName") String userName);
/**
* ID

View File

@ -152,7 +152,8 @@
<select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult">
<include refid="selectUserVo"/>
where u.user_name = #{userName} and u.del_flag = '0'
where u.email = #{userName} and
u.del_flag = '0'
</select>
<select id="selectUserById" parameterType="Long" resultMap="SysUserResult">