Merge branch 'feature/bug-558' into develop
This commit is contained in:
commit
45c4399369
|
|
@ -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<AppLoginVO> 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()))
|
||||
|
|
|
|||
|
|
@ -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<AppUserMapper, AppUser> 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue