|
@@ -16,6 +16,7 @@ import org.springframework.security.core.userdetails.User;
|
|
|
import org.springframework.security.core.userdetails.UserDetails;
|
|
|
import org.springframework.security.core.userdetails.UserDetailsService;
|
|
|
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
|
|
+import org.springframework.security.crypto.password.PasswordEncoder;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.web.context.request.RequestContextHolder;
|
|
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
|
@@ -34,6 +35,8 @@ public class UserServiceImpl implements UserDetailsService {
|
|
|
private RedisTemplate redisTemplate;
|
|
|
@Autowired
|
|
|
private SysRoleService sysRoleService;
|
|
|
+ @Autowired
|
|
|
+ private PasswordEncoder passwordEncoder;
|
|
|
@Override
|
|
|
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
|
|
|
if (StringUtils.isBlank(username)) {
|
|
@@ -59,7 +62,7 @@ public class UserServiceImpl implements UserDetailsService {
|
|
|
if (code.equals(object.toString())){
|
|
|
redisTemplate.opsForValue().set(username+"_info", JSON.toJSONString(tenant));
|
|
|
|
|
|
- return new User(tenant.getTenantPhone(),code,new ArrayList<>() );
|
|
|
+ return new User(tenant.getTenantPhone(),passwordEncoder.encode(code),new ArrayList<>() );
|
|
|
}
|
|
|
throw new UsernameNotFoundException("验证码错误");
|
|
|
}
|