From c83cebf5f6cfcdf484a9e05e4edfe617aa33c060 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B9=E9=B9=8F=E9=A3=9E?= Date: Fri, 8 Aug 2025 15:57:36 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20bug-558=20=E7=99=BB=E5=BD=95=E5=94=AE?= =?UTF-8?q?=E5=90=8E=E6=9C=8D=E5=8A=A1=E7=B3=BB=E7=BB=9FPC=E5=AE=A2?= =?UTF-8?q?=E6=88=B7=E7=AB=AF=EF=BC=8C=E6=88=96APP=E7=AB=AF=E3=80=82?= =?UTF-8?q?=E4=BC=98=E5=85=88=E5=8F=96=E4=BB=A3=E7=90=86=E5=95=86=E8=B4=A6?= =?UTF-8?q?=E5=8F=B7=EF=BC=8C=E4=BB=A5=E4=BB=A3=E7=90=86=E5=95=86=E8=B4=A6?= =?UTF-8?q?=E5=8F=B7=E4=B8=BA=E5=87=86=E3=80=82=E6=B2=A1=E6=9C=89=E4=BB=A3?= =?UTF-8?q?=E7=90=86=E5=95=86=E8=B4=A6=E5=8F=B7=EF=BC=8C=E5=86=8D=E5=8F=96?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E7=AB=AF=E5=86=85=E9=83=A8=E8=B4=A6=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nflg/mobilebroken/auth/controller/AppController.java | 5 +++++ .../repository/service/impl/AppUserServiceImpl.java | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/nflg-mobilebroken-auth/src/main/java/com/nflg/mobilebroken/auth/controller/AppController.java b/nflg-mobilebroken-auth/src/main/java/com/nflg/mobilebroken/auth/controller/AppController.java index da5972ad..18489dca 100644 --- a/nflg-mobilebroken-auth/src/main/java/com/nflg/mobilebroken/auth/controller/AppController.java +++ b/nflg-mobilebroken-auth/src/main/java/com/nflg/mobilebroken/auth/controller/AppController.java @@ -14,6 +14,8 @@ import com.nflg.mobilebroken.common.util.*; import com.nflg.mobilebroken.repository.entity.AdminUser; import com.nflg.mobilebroken.repository.entity.AppUser; import com.nflg.mobilebroken.repository.service.*; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -48,6 +50,7 @@ public class AppController extends ControllerBase { @Resource private IAdminUserRoleMapService adminUserRoleMapService; + private static final PasswordEncoder PASSWORDENCODER = new BCryptPasswordEncoder(); /** * 用户端登录 @@ -59,6 +62,8 @@ public class AppController extends ControllerBase { public ApiResult login(String userName, String password) { AppUser user = appUserService.getUser(userName, password); if (Objects.nonNull(user)) { + VUtils.trueThrowBusinessError(!PASSWORDENCODER.matches(password, user.getPassword())) + .throwMessage(dictionaryItemTranslateService.getValueByCode(Constant.DICTIONARY_SYSTEMERROR, Constant.DICTIONARY_ITEM_INCORRECTUSERNAMEORPASSWORD, MultilingualUtil.getLanguage())); VUtils.trueThrow(Objects.equals(user.getState(), UserState.Disabled.getState())) .throwMessage(STATE.PassportErr, dictionaryItemTranslateService.getValueByCode(Constant.DICTIONARY_SYSTEMERROR, Constant.DICTIONARY_ITEM_ACCOUNT_DISABLED, user.getLanguageCode())); VUtils.trueThrow(Objects.equals(user.getState(), UserState.ToBeActivated.getState())) diff --git a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/AppUserServiceImpl.java b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/AppUserServiceImpl.java index 8465ecdd..f67fe958 100644 --- a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/AppUserServiceImpl.java +++ b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/AppUserServiceImpl.java @@ -11,7 +11,10 @@ import com.nflg.mobilebroken.common.exception.NflgException; import com.nflg.mobilebroken.common.pojo.PageData; import com.nflg.mobilebroken.common.pojo.request.*; import com.nflg.mobilebroken.common.pojo.vo.*; -import com.nflg.mobilebroken.common.util.*; +import com.nflg.mobilebroken.common.util.AdminUserUtil; +import com.nflg.mobilebroken.common.util.AppUserUtil; +import com.nflg.mobilebroken.common.util.PageUtil; +import com.nflg.mobilebroken.common.util.VUtils; import com.nflg.mobilebroken.repository.entity.*; import com.nflg.mobilebroken.repository.mapper.AppUserMapper; import com.nflg.mobilebroken.repository.service.*; @@ -75,8 +78,6 @@ public class AppUserServiceImpl extends ServiceImpl impl .eq(AppUser::getIsDel, false) .eq(AppUser::getLoginName, userName) .one(); - VUtils.trueThrowBusinessError(Objects.isNull(user) || !PASSWORDENCODER.matches(password, user.getPassword())) - .throwMessage(dictionaryItemTranslateService.getValueByCode(Constant.DICTIONARY_SYSTEMERROR, Constant.DICTIONARY_ITEM_INCORRECTUSERNAMEORPASSWORD, MultilingualUtil.getLanguage())); return user; }