This commit is contained in:
xiangwb
2018-03-28 17:01:05 +08:00
parent 38b70463e7
commit 614698b4ef
2 changed files with 3 additions and 7 deletions
@@ -126,9 +126,6 @@ public class SysUserControl {
if (StringUtils.isEmpty(userName) || StringUtils.isEmpty(passWord)) {
return JsonResult.toJSONObj("用户名或密码不能为空");
}
if (StringUtils.isEmpty(checkCode)) {
return JsonResult.toJSONObj("请输入验证码");
}
SysUser user = sysUserService.getByUserName(userName);
Subject subject = SecurityUtils.getSubject();
String ip = IpUtil.getIpAddr(request);
@@ -7,9 +7,9 @@ import com.xwbing.domain.entity.sys.SysUser;
import com.xwbing.exception.BusinessException;
import com.xwbing.service.sys.SysRoleService;
import com.xwbing.service.sys.SysUserService;
import com.xwbing.util.CommonDataUtil;
import com.xwbing.util.captcha.CaptchaException;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
@@ -92,9 +92,8 @@ public class MyShiroRealm extends AuthorizingRealm {
throw new BusinessException("密码错误");
}
String captcha = captchaToken.getCaptcha();
String exitCode = (String) SecurityUtils.getSubject().getSession()
.getAttribute(CommonConstant.KEY_CAPTCHA);
if (StringUtils.isEmpty(captcha) || !captcha.equalsIgnoreCase(exitCode)) {
String imgCode = (String) CommonDataUtil.getToken(CommonConstant.KEY_CAPTCHA);
if (StringUtils.isEmpty(captcha) || !captcha.equalsIgnoreCase(imgCode)) {
throw new CaptchaException("验证码错误");
}
return new SimpleAuthenticationInfo(user, sysPassWord,