2
0

feat: 支持邮箱登录

This commit is contained in:
caiyuchao
2025-04-16 09:46:20 +08:00
parent 475b9a5184
commit e8b672f119
4 changed files with 12 additions and 12 deletions

View File

@@ -56,11 +56,11 @@ public class SysLoginService {
throw new ServiceException("auth.password.not.in.specified.range"); throw new ServiceException("auth.password.not.in.specified.range");
} }
// 用户名不在指定范围内 错误 // 用户名不在指定范围内 错误
if (username.length() < UserConstants.USERNAME_MIN_LENGTH // if (username.length() < UserConstants.USERNAME_MIN_LENGTH
|| username.length() > UserConstants.USERNAME_MAX_LENGTH) { // || username.length() > UserConstants.USERNAME_MAX_LENGTH) {
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "auth.username.not.in.specified.range"); // recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "auth.username.not.in.specified.range");
throw new ServiceException("auth.username.not.in.specified.range"); // throw new ServiceException("auth.username.not.in.specified.range");
} // }
// IP黑名单校验 // IP黑名单校验
String blackStr = Convert.toStr(redisService.getCacheObject(CacheConstants.SYS_LOGIN_BLACKIPLIST)); String blackStr = Convert.toStr(redisService.getCacheObject(CacheConstants.SYS_LOGIN_BLACKIPLIST));
if (IpUtils.isMatchedIp(blackStr, IpUtils.getIpAddr())) { if (IpUtils.isMatchedIp(blackStr, IpUtils.getIpAddr())) {

View File

@@ -56,11 +56,11 @@ public class ULoginService {
throw new ServiceException("auth.password.not.in.specified.range"); throw new ServiceException("auth.password.not.in.specified.range");
} }
// 用户名不在指定范围内 错误 // 用户名不在指定范围内 错误
if (username.length() < UserConstants.USERNAME_MIN_LENGTH // if (username.length() < UserConstants.USERNAME_MIN_LENGTH
|| username.length() > UserConstants.USERNAME_MAX_LENGTH) { // || username.length() > UserConstants.USERNAME_MAX_LENGTH) {
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "auth.username.not.in.specified.range"); // recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "auth.username.not.in.specified.range");
throw new ServiceException("auth.username.not.in.specified.range"); // throw new ServiceException("auth.username.not.in.specified.range");
} // }
// IP黑名单校验 // IP黑名单校验
String blackStr = Convert.toStr(redisService.getCacheObject(CacheConstants.SYS_LOGIN_BLACKIPLIST)); String blackStr = Convert.toStr(redisService.getCacheObject(CacheConstants.SYS_LOGIN_BLACKIPLIST));
if (IpUtils.isMatchedIp(blackStr, IpUtils.getIpAddr())) { if (IpUtils.isMatchedIp(blackStr, IpUtils.getIpAddr())) {

View File

@@ -125,7 +125,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult"> <select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult">
<include refid="selectUserVo"/> <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>
<select id="selectUserByEmail" parameterType="String" resultMap="SysUserResult"> <select id="selectUserByEmail" parameterType="String" resultMap="SysUserResult">

View File

@@ -148,7 +148,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectUserByUserName" parameterType="String" resultMap="UUserResult"> <select id="selectUserByUserName" parameterType="String" resultMap="UUserResult">
<include refid="selectUserVo"/> <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>
<select id="selectUserByEmail" parameterType="String" resultMap="UUserResult"> <select id="selectUserByEmail" parameterType="String" resultMap="UUserResult">