宁夏试运行问题修改
This commit is contained in:
parent
793d29c1ec
commit
84299f69af
|
|
@ -6,6 +6,7 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import com.bonus.sgzb.auth.form.*;
|
||||
import com.bonus.sgzb.auth.service.NwRegisterService;
|
||||
import com.bonus.sgzb.auth.service.NwUserLoginService;
|
||||
import com.bonus.sgzb.auth.utils.RsaUtil;
|
||||
import com.bonus.sgzb.common.core.constant.CacheConstants;
|
||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.sgzb.common.redis.service.RedisService;
|
||||
|
|
@ -34,6 +35,7 @@ import java.util.Map;
|
|||
@Slf4j
|
||||
public class TokenController {
|
||||
|
||||
private final String privateKey = "MIIBVAIBADANBgkqhkiG9w0BAQEFAASCAT4wggE6AgEAAkEAqhHyZfSsYourNxaY7Nt+PrgrxkiA50efORdI5U5lsW79MmFnusUA355oaSXcLhu5xxB38SMSyP2KvuKNPuH3owIDAQABAkAfoiLyL+Z4lf4Myxk6xUDgLaWGximj20CUf+5BKKnlrK+Ed8gAkM0HqoTt2UZwA5E2MzS4EI2gjfQhz5X28uqxAiEA3wNFxfrCZlSZHb0gn2zDpWowcSxQAgiCstxGUoOqlW8CIQDDOerGKH5OmCJ4Z21v+F25WaHYPxCFMvwxpcw99EcvDQIgIdhDTIqD2jfYjPTY8Jj3EDGPbH2HHuffvflECt3Ek60CIQCFRlCkHpi7hthhYhovyloRYsM+IS9h/0BzlEAuO0ktMQIgSPT3aFAgJYwKpqRYKlLDVcflZFCKY7u3UP8iWi1Qw0Y=";
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
|
|
@ -54,18 +56,25 @@ public class TokenController {
|
|||
|
||||
//web端登录
|
||||
@PostMapping("login")
|
||||
public R<?> login(@RequestBody LoginBody form) {
|
||||
public R<?> login(@RequestBody LoginBody form) throws Exception {
|
||||
String decryptedData = RsaUtil.decryptByPrivateKey(form.getPassword(), privateKey);
|
||||
// 用户登录
|
||||
LoginUser userInfo = sysLoginService.login(form.getUsername(), form.getPassword());
|
||||
LoginUser userInfo = sysLoginService.login(form.getUsername(), decryptedData);
|
||||
String uuid = form.getUuid();
|
||||
String captcha = redisService.getCacheObject(CacheConstants.CAPTCHA_CODE_KEY + uuid).toString();
|
||||
if (StringUtils.isBlank(captcha)){
|
||||
if (StringUtils.isBlank(captcha)) {
|
||||
// 删除验证码缓存
|
||||
redisService.deleteObject(CacheConstants.CAPTCHA_CODE_KEY + uuid);
|
||||
return R.fail("验证码超时,请重新刷新");
|
||||
}
|
||||
if (form.getCode() != null && form.getCode().equals(captcha)) {
|
||||
// 删除验证码缓存
|
||||
redisService.deleteObject(CacheConstants.CAPTCHA_CODE_KEY + uuid);
|
||||
// 获取登录token
|
||||
return R.ok(tokenService.createToken(userInfo));
|
||||
} else {
|
||||
// 删除验证码缓存
|
||||
redisService.deleteObject(CacheConstants.CAPTCHA_CODE_KEY + uuid);
|
||||
return R.fail("验证码错误");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue