feat: 支持邮箱登录
This commit is contained in:
@@ -56,11 +56,11 @@ public class SysLoginService {
|
||||
throw new ServiceException("auth.password.not.in.specified.range");
|
||||
}
|
||||
// 用户名不在指定范围内 错误
|
||||
if (username.length() < UserConstants.USERNAME_MIN_LENGTH
|
||||
|| username.length() > UserConstants.USERNAME_MAX_LENGTH) {
|
||||
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "auth.username.not.in.specified.range");
|
||||
throw new ServiceException("auth.username.not.in.specified.range");
|
||||
}
|
||||
// if (username.length() < UserConstants.USERNAME_MIN_LENGTH
|
||||
// || username.length() > UserConstants.USERNAME_MAX_LENGTH) {
|
||||
// recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "auth.username.not.in.specified.range");
|
||||
// throw new ServiceException("auth.username.not.in.specified.range");
|
||||
// }
|
||||
// IP黑名单校验
|
||||
String blackStr = Convert.toStr(redisService.getCacheObject(CacheConstants.SYS_LOGIN_BLACKIPLIST));
|
||||
if (IpUtils.isMatchedIp(blackStr, IpUtils.getIpAddr())) {
|
||||
|
||||
@@ -56,11 +56,11 @@ public class ULoginService {
|
||||
throw new ServiceException("auth.password.not.in.specified.range");
|
||||
}
|
||||
// 用户名不在指定范围内 错误
|
||||
if (username.length() < UserConstants.USERNAME_MIN_LENGTH
|
||||
|| username.length() > UserConstants.USERNAME_MAX_LENGTH) {
|
||||
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "auth.username.not.in.specified.range");
|
||||
throw new ServiceException("auth.username.not.in.specified.range");
|
||||
}
|
||||
// if (username.length() < UserConstants.USERNAME_MIN_LENGTH
|
||||
// || username.length() > UserConstants.USERNAME_MAX_LENGTH) {
|
||||
// recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "auth.username.not.in.specified.range");
|
||||
// throw new ServiceException("auth.username.not.in.specified.range");
|
||||
// }
|
||||
// IP黑名单校验
|
||||
String blackStr = Convert.toStr(redisService.getCacheObject(CacheConstants.SYS_LOGIN_BLACKIPLIST));
|
||||
if (IpUtils.isMatchedIp(blackStr, IpUtils.getIpAddr())) {
|
||||
|
||||
@@ -125,7 +125,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult">
|
||||
<include refid="selectUserVo"/>
|
||||
where u.user_name = #{userName} and u.del_flag = '0'
|
||||
where (u.user_name = #{userName} or u.email = #{userName}) and u.del_flag = '0'
|
||||
</select>
|
||||
|
||||
<select id="selectUserByEmail" parameterType="String" resultMap="SysUserResult">
|
||||
|
||||
@@ -148,7 +148,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<select id="selectUserByUserName" parameterType="String" resultMap="UUserResult">
|
||||
<include refid="selectUserVo"/>
|
||||
where u.user_name = #{userName} and u.del_flag = '0'
|
||||
where (u.user_name = #{userName} or u.email = #{userName}) and u.del_flag = '0'
|
||||
</select>
|
||||
|
||||
<select id="selectUserByEmail" parameterType="String" resultMap="UUserResult">
|
||||
|
||||
Reference in New Issue
Block a user