|
@@ -29,23 +29,28 @@ public class UserServiceImpl implements UserDetailsService {
|
|
|
if (StringUtils.isBlank(username)) {
|
|
|
throw new UsernameNotFoundException("username is empty");
|
|
|
}
|
|
|
+ HttpServletRequest request = ((ServletRequestAttributes) (RequestContextHolder.currentRequestAttributes())).getRequest();
|
|
|
EduTenant tenant = eduTenantMapper.selectOne(new LambdaQueryWrapper<EduTenant>().eq(EduTenant::getTenantPhone, username));
|
|
|
if (tenant == null) {
|
|
|
throw new UsernameNotFoundException("username not found");
|
|
|
}
|
|
|
- HttpServletRequest request = ((ServletRequestAttributes) (RequestContextHolder.currentRequestAttributes())).getRequest();
|
|
|
- String code = request.getParameter("password");
|
|
|
- if (StringUtils.isBlank(code)) {
|
|
|
- throw new UsernameNotFoundException("验证码为空");
|
|
|
- }
|
|
|
- Object object = "1234";//redisTemplate.opsForValue().get("code_" + username);
|
|
|
- if (object == null) {
|
|
|
- throw new UsernameNotFoundException("验证码为空");
|
|
|
+ if ("admin".equals(request.getParameter("loginFrom"))) {
|
|
|
+ return new User(tenant.getTenantPhone(),null,new ArrayList<>());
|
|
|
+ }else {
|
|
|
+ String code = request.getParameter("password");
|
|
|
+ if (StringUtils.isBlank(code)) {
|
|
|
+ throw new UsernameNotFoundException("验证码为空");
|
|
|
+ }
|
|
|
+ Object object = "1234";//redisTemplate.opsForValue().get("code_" + username);
|
|
|
+ if (object == null) {
|
|
|
+ throw new UsernameNotFoundException("验证码为空");
|
|
|
+ }
|
|
|
+ if (code.equals(object.toString())){
|
|
|
+ redisTemplate.opsForValue().set(username+"_info", JSON.toJSONString(tenant));
|
|
|
+ return new User(tenant.getTenantPhone(),code,new ArrayList<>());
|
|
|
+ }
|
|
|
+ throw new UsernameNotFoundException("验证码错误");
|
|
|
}
|
|
|
- if (code.equals(object.toString())){
|
|
|
- redisTemplate.opsForValue().set(username+"_info", JSON.toJSONString(tenant));
|
|
|
- return new User(tenant.getTenantPhone(),code,new ArrayList<>());
|
|
|
- }
|
|
|
- throw new UsernameNotFoundException("验证码错误");
|
|
|
+
|
|
|
}
|
|
|
}
|