修正已验证手机号登录校验
This commit is contained in:
+9
-1
@@ -1083,7 +1083,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserDO> implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
private LoginResponseVO phoneLoginByVerifiedPhone(String phone, Long shopId, boolean rememberMe) {
|
private LoginResponseVO phoneLoginByVerifiedPhone(String phone, Long shopId, boolean rememberMe) {
|
||||||
String normalizedPhone = validateUserPhone(phone, null, true);
|
String normalizedPhone = normalizeVerifiedPhone(phone);
|
||||||
|
|
||||||
UserDO userDO = userMapper.selectOne(
|
UserDO userDO = userMapper.selectOne(
|
||||||
Wrappers.lambdaQuery(UserDO.class)
|
Wrappers.lambdaQuery(UserDO.class)
|
||||||
@@ -1104,6 +1104,14 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserDO> implements
|
|||||||
return buildLoginResponse(userDO, resolvedShopId, ENCODED_UNSET_PASSWORD.equals(userDO.getPassword()), rememberMe);
|
return buildLoginResponse(userDO, resolvedShopId, ENCODED_UNSET_PASSWORD.equals(userDO.getPassword()), rememberMe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String normalizeVerifiedPhone(String phone) {
|
||||||
|
String normalizedPhone = phone == null ? null : phone.trim();
|
||||||
|
if (!StringUtils.hasText(normalizedPhone) || !normalizedPhone.matches(PHONE_REGEX)) {
|
||||||
|
throw new RuntimeException("手机号格式不正确");
|
||||||
|
}
|
||||||
|
return normalizedPhone;
|
||||||
|
}
|
||||||
|
|
||||||
private LoginResponseVO buildRegistrationRequiredResponse(String phone, UserDO userDO, String reason) {
|
private LoginResponseVO buildRegistrationRequiredResponse(String phone, UserDO userDO, String reason) {
|
||||||
WorkbenchRegistrationApplicationDO application = userDO == null ? null : registrationApplicationMapper.selectOne(
|
WorkbenchRegistrationApplicationDO application = userDO == null ? null : registrationApplicationMapper.selectOne(
|
||||||
Wrappers.lambdaQuery(WorkbenchRegistrationApplicationDO.class)
|
Wrappers.lambdaQuery(WorkbenchRegistrationApplicationDO.class)
|
||||||
|
|||||||
Reference in New Issue
Block a user