员工账号 唯一问题

登录
This commit is contained in:
2024-07-30 15:29:19 +08:00
parent 4655786218
commit a2844da331
2 changed files with 6 additions and 10 deletions

View File

@@ -98,7 +98,7 @@ public class AuthorizationController {
if (authUser.isChecked() && StringUtils.isBlank(authUser.getCode()) || authUser.isChecked() && !authUser.getCode().equalsIgnoreCase(code)) {
throw new BadRequestException("验证码错误");
}
String loginpre="";
// 判断是否是员工登录
if (authUser.getLoginType() != null && "staff".equals(authUser.getLoginType())) {
if (StrUtil.isBlank(authUser.getMerchantName())) {
@@ -109,13 +109,12 @@ public class AuthorizationController {
if (merchant == null) {
throw new BadRequestException("商户不存在");
}
authUser.setUsername(merchant.getShopId() + "@" + authUser.getUsername());
loginpre=merchant.getShopId() + "@";
}
//生成token
UsernamePasswordAuthenticationToken authenticationToken =
new UsernamePasswordAuthenticationToken(authUser.getUsername(), password);
new UsernamePasswordAuthenticationToken(loginpre+authUser.getUsername(), password);
Authentication authentication = authenticationManagerBuilder.getObject().authenticate(authenticationToken);
SecurityContextHolder.getContext().setAuthentication(authentication);
// 生成令牌与第三方系统获取令牌方式