| | |
| | | import com.ruoyi.system.service.TAppUserService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.security.authentication.AuthenticationManager; |
| | | import org.springframework.security.authentication.BadCredentialsException; |
| | | import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; |
| | |
| | | private SysPermissionService permissionService; |
| | | @Autowired |
| | | private TAppUserService tAppUserService; |
| | | |
| | | @Value("${spring.profiles.active}") |
| | | private String env; |
| | | |
| | | /** |
| | | * 登录验证 |
| | |
| | | log.info("登录用户:{} 已被删除.", username); |
| | | throw new ServiceException(MessageUtils.message("user.password.delete")); |
| | | } |
| | | // 校验验证码 |
| | | Object cacheObject = redisCache.getCacheObject(user.getPhone()); |
| | | if(!code.equals(String.valueOf(cacheObject))){ |
| | | log.info("登录用户:{} 短信验证码错误{}", username,code); |
| | | throw new ServiceException("短信验证码错误"); |
| | | if ("test".equals(env) || "dev".equals(env)) { |
| | | if (!code.equals("111111")) { |
| | | log.info("登录用户:{} 短信验证码错误{}", username,code); |
| | | throw new ServiceException("短信验证码错误"); |
| | | } |
| | | } else { |
| | | // 校验验证码 |
| | | Object cacheObject = redisCache.getCacheObject(user.getPhone()); |
| | | if(!code.equals(String.valueOf(cacheObject))){ |
| | | log.info("登录用户:{} 短信验证码错误{}", username,code); |
| | | throw new ServiceException("短信验证码错误"); |
| | | } |
| | | } |
| | | |
| | | AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success"))); |
| | | LoginUserApplet loginUser = new LoginUserApplet(user.getId(), null, null, null); |
| | | recordAppLoginInfo(loginUser.getUserId().toString()); |