Commit 17ff759553a0c06dc1dd02c9c13e64b993ba9ad2
Committed by
GitHub
Merge pull request #568 from DevDengChao/fix/disabled-user-login-via-sms
fix: 修复被禁用的账户可以通过短信验证码再次登录的问题
Showing
1 changed file
with
7 additions
and
1 deletions
yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/auth/MemberAuthServiceImpl.java
| ... | ... | @@ -88,6 +88,12 @@ public class MemberAuthServiceImpl implements MemberAuthService { |
| 88 | 88 | MemberUserDO user = userService.createUserIfAbsent(reqVO.getMobile(), userIp, getTerminal()); |
| 89 | 89 | Assert.notNull(user, "获取用户失败,结果为空"); |
| 90 | 90 | |
| 91 | + // 校验是否禁用 | |
| 92 | + if (CommonStatusEnum.isDisable(user.getStatus())) { | |
| 93 | + createLoginLog(user.getId(), reqVO.getMobile(), LoginLogTypeEnum.LOGIN_SMS, LoginResultEnum.USER_DISABLED); | |
| 94 | + throw exception(AUTH_LOGIN_USER_DISABLED); | |
| 95 | + } | |
| 96 | + | |
| 91 | 97 | // 如果 socialType 非空,说明需要绑定社交用户 |
| 92 | 98 | String openid = null; |
| 93 | 99 | if (reqVO.getSocialType() != null) { |
| ... | ... | @@ -177,7 +183,7 @@ public class MemberAuthServiceImpl implements MemberAuthService { |
| 177 | 183 | throw exception(AUTH_LOGIN_BAD_CREDENTIALS); |
| 178 | 184 | } |
| 179 | 185 | // 校验是否禁用 |
| 180 | - if (ObjectUtil.notEqual(user.getStatus(), CommonStatusEnum.ENABLE.getStatus())) { | |
| 186 | + if (CommonStatusEnum.isDisable(user.getStatus())) { | |
| 181 | 187 | createLoginLog(user.getId(), mobile, logTypeEnum, LoginResultEnum.USER_DISABLED); |
| 182 | 188 | throw exception(AUTH_LOGIN_USER_DISABLED); |
| 183 | 189 | } | ... | ... |