|
|
|
@@ -8,6 +8,7 @@ import com.iformall.common.ResultData; |
|
|
|
import com.iformall.domain.po.MallRolePermission; |
|
|
|
import com.iformall.domain.po.MallUserInfo; |
|
|
|
import com.iformall.domain.po.MallUserRole; |
|
|
|
import com.iformall.exception.MallinkException; |
|
|
|
import com.iformall.service.MallRolePermissionService; |
|
|
|
import com.iformall.service.MallUserRoleService; |
|
|
|
import com.iformall.shiro.UserSession; |
|
|
|
@@ -70,11 +71,17 @@ public class HomeController { |
|
|
|
@ApiOperation("登录") |
|
|
|
@PostMapping("/doLogin") |
|
|
|
public ResultData login(@RequestBody MallUserInfo user) { |
|
|
|
String kaptcha = ShiroUtils.getKaptcha(Constants.KAPTCHA_SESSION_KEY); |
|
|
|
if(!user.getCaptcha().equalsIgnoreCase(kaptcha)){ |
|
|
|
return new ResultData(ErrorCode.KAPCHA_NOT_EQUAL); |
|
|
|
try { |
|
|
|
String kaptcha = ShiroUtils.getKaptcha(Constants.KAPTCHA_SESSION_KEY); |
|
|
|
if(!user.getCaptcha().equalsIgnoreCase(kaptcha)){ |
|
|
|
return new ResultData(ErrorCode.KAPCHA_NOT_EQUAL); |
|
|
|
} |
|
|
|
} catch (MallinkException e) { |
|
|
|
logger.error("验证码" + e.getMessage()); |
|
|
|
return new ResultData(ErrorCode.KAPCHA_NOT_VALID.getCode(), e.getMessage()); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ResultData data = new ResultData(); |
|
|
|
if (StringUtils.isEmpty(user.getUsername()) || StringUtils.isEmpty(user.getPassword())) { |
|
|
|
// throw new SystemException(ErrorCode.LOGIN_USER_OR_PWD_ERROR); |
|
|
|
|