Commit 87649777 authored by 吴卿华's avatar 吴卿华

app 记住密码登录

parent cc3d41c6
......@@ -23,7 +23,7 @@ import com.zehong.system.service.ISysMenuService;
/**
* 登录验证
*
*
* @author zehong
*/
@RestController
......@@ -46,7 +46,7 @@ public class SysLoginController
/**
* 登录方法
*
*
* @param loginBody 登录信息
* @return 结果
*/
......@@ -56,14 +56,14 @@ public class SysLoginController
AjaxResult ajax = AjaxResult.success();
// 生成令牌
String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
loginBody.getUuid());
loginBody.getUuid(),loginBody.getRememberPsw());
ajax.put(Constants.TOKEN, token);
return ajax;
}
/**
* 获取用户信息
*
*
* @return 用户信息
*/
@GetMapping("getInfo")
......@@ -85,7 +85,7 @@ public class SysLoginController
/**
* 获取路由信息
*
*
* @return 路由信息
*/
@GetMapping("getRouters")
......
......@@ -2,7 +2,7 @@ package com.zehong.common.core.domain.model;
/**
* 用户登录对象
*
*
* @author zehong
*/
public class LoginBody
......@@ -27,6 +27,20 @@ public class LoginBody
*/
private String uuid = "";
/**
* 手机端 记住密码登录 验证是否通过验证码
* @return
*/
private int rememberPsw;
public int getRememberPsw() {
return rememberPsw;
}
public void setRememberPsw(int rememberPsw) {
this.rememberPsw = rememberPsw;
}
public String getUsername()
{
return username;
......
......@@ -25,7 +25,7 @@ import com.zehong.system.service.ISysUserService;
/**
* 登录校验方法
*
*
* @author zehong
*/
@Component
......@@ -39,20 +39,20 @@ public class SysLoginService
@Autowired
private RedisCache redisCache;
@Autowired
private ISysUserService userService;
/**
* 登录验证
*
*
* @param username 用户名
* @param password 密码
* @param code 验证码
* @param uuid 唯一标识
* @return 结果
*/
public String login(String username, String password, String code, String uuid)
public String login(String username, String password, String code, String uuid,int rememberPsw)
{
String verifyKey = Constants.CAPTCHA_CODE_KEY + uuid;
String captcha = redisCache.getCacheObject(verifyKey);
......@@ -62,10 +62,11 @@ public class SysLoginService
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.expire")));
throw new CaptchaExpireException();
}
if (!code.equalsIgnoreCase(captcha))
{
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.error")));
throw new CaptchaException();
if (rememberPsw!=1) {
if (!code.equalsIgnoreCase(captcha)) {
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.error")));
throw new CaptchaException();
}
}
// 用户验证
Authentication authentication = null;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment