修正已验证手机号登录校验

This commit is contained in:
2026-09-11 15:31:33 +08:00
parent 8c5170cb7e
commit e9a2e74b91
@@ -1083,7 +1083,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserDO> implements
}
private LoginResponseVO phoneLoginByVerifiedPhone(String phone, Long shopId, boolean rememberMe) {
String normalizedPhone = validateUserPhone(phone, null, true);
String normalizedPhone = normalizeVerifiedPhone(phone);
UserDO userDO = userMapper.selectOne(
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);
}
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) {
WorkbenchRegistrationApplicationDO application = userDO == null ? null : registrationApplicationMapper.selectOne(
Wrappers.lambdaQuery(WorkbenchRegistrationApplicationDO.class)