From 4f6f15b818704079ff2e4e4719b798f48d68a335 Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期五, 11 九月 2026 13:52:19 +0800
Subject: [PATCH] update
---
backend/src/main/java/com/tourguide/modules/user/service/AuthService.java | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/backend/src/main/java/com/tourguide/modules/user/service/AuthService.java b/backend/src/main/java/com/tourguide/modules/user/service/AuthService.java
index 62c49e6..2fdd59b 100644
--- a/backend/src/main/java/com/tourguide/modules/user/service/AuthService.java
+++ b/backend/src/main/java/com/tourguide/modules/user/service/AuthService.java
@@ -21,6 +21,7 @@
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.StringUtils;
import java.nio.charset.StandardCharsets;
import java.util.List;
@@ -134,12 +135,20 @@
private GuideUser findLoginableGuideByPhone(String phone) {
GuideUser user = guideUserService.findByPhone(phone);
validateGuideLoginStatus(user, "手机号未注册");
+ validateGuideLoginPhone(user, phone);
guideAutoDisableService.disableGuideIfEligible(user.getId());
GuideUser currentUser = guideUserService.findByPhone(phone);
validateGuideLoginStatus(currentUser, "手机号未注册");
+ validateGuideLoginPhone(currentUser, phone);
return currentUser;
}
+ private void validateGuideLoginPhone(GuideUser user, String phone) {
+ if (StringUtils.hasText(user.getMobile()) && !phone.equals(user.getMobile())) {
+ throw new BusinessException(401, "手机号未注册");
+ }
+ }
+
private void validateGuideLoginStatus(GuideUser user, String notFoundMessage) {
if (user == null) {
throw new BusinessException(401, notFoundMessage);
--
Gitblit v1.7.1