|
|
@@ -62,42 +62,42 @@ public class SysUserLoginController {
|
|
|
ImageIO.write(image, "jpg", out);
|
|
|
}
|
|
|
|
|
|
- @PostMapping("login")
|
|
|
- @ApiImplicitParams({
|
|
|
- @ApiImplicitParam(name = "userCode", value = "用户名", example = "root", required = true, dataType = "String", paramType = "query"),
|
|
|
- @ApiImplicitParam(name = "password", value = "密码", example = "1234", required = true, dataType = "string", paramType = "query")
|
|
|
-// @ApiImplicitParam(name = "rand", value = "验证码", example = "a",required = true, dataType = "string", paramType = "query")
|
|
|
- })
|
|
|
- public Result login(@RequestParam(required = true, value = "userCode") String userCode, @RequestParam(required = true, value = "password") String password, HttpServletResponse response
|
|
|
- ) {
|
|
|
-
|
|
|
-// if (!"a".equals(rand)){
|
|
|
-// String kaptcha = ShiroUtils.getKaptcha(Constants.KAPTCHA_SESSION_KEY);
|
|
|
+// @PostMapping("login")
|
|
|
+// @ApiImplicitParams({
|
|
|
+// @ApiImplicitParam(name = "userCode", value = "用户名", example = "root", required = true, dataType = "String", paramType = "query"),
|
|
|
+// @ApiImplicitParam(name = "password", value = "密码", example = "1234", required = true, dataType = "string", paramType = "query")
|
|
|
+//// @ApiImplicitParam(name = "rand", value = "验证码", example = "a",required = true, dataType = "string", paramType = "query")
|
|
|
+// })
|
|
|
+// public Result login(@RequestParam(required = true, value = "userCode") String userCode, @RequestParam(required = true, value = "password") String password, HttpServletResponse response
|
|
|
+// ) {
|
|
|
//
|
|
|
-// if(!rand.equalsIgnoreCase(kaptcha)){
|
|
|
-// return Result.error("验证码不正确");
|
|
|
-// }
|
|
|
+//// if (!"a".equals(rand)){
|
|
|
+//// String kaptcha = ShiroUtils.getKaptcha(Constants.KAPTCHA_SESSION_KEY);
|
|
|
+////
|
|
|
+//// if(!rand.equalsIgnoreCase(kaptcha)){
|
|
|
+//// return Result.error("验证码不正确");
|
|
|
+//// }
|
|
|
+//// }
|
|
|
+// String role = "0";
|
|
|
+// try {
|
|
|
+// Subject subject = ShiroUtils.getSubject();
|
|
|
+// UsernamePasswordToken token = new UsernamePasswordToken(userCode, password);
|
|
|
+// subject.login(token);
|
|
|
+// SysUserRole sysUserRole = sysUserRoleService.selectByUser(ShiroUtils.getUserId());
|
|
|
+// } catch (UnknownAccountException e) {
|
|
|
+// return Result.error(e.getMessage());
|
|
|
+// } catch (IncorrectCredentialsException e) {
|
|
|
+// return Result.error("账号或密码不正确");
|
|
|
+// } catch (LockedAccountException e) {
|
|
|
+// return Result.error("账号已被锁定,请联系管理员");
|
|
|
+// } catch (AuthenticationException e) {
|
|
|
+// return Result.error("账户验证失败");
|
|
|
// }
|
|
|
- String role = "0";
|
|
|
- try {
|
|
|
- Subject subject = ShiroUtils.getSubject();
|
|
|
- UsernamePasswordToken token = new UsernamePasswordToken(userCode, password);
|
|
|
- subject.login(token);
|
|
|
- SysUserRole sysUserRole = sysUserRoleService.selectByUser(ShiroUtils.getUserId());
|
|
|
- } catch (UnknownAccountException e) {
|
|
|
- return Result.error(e.getMessage());
|
|
|
- } catch (IncorrectCredentialsException e) {
|
|
|
- return Result.error("账号或密码不正确");
|
|
|
- } catch (LockedAccountException e) {
|
|
|
- return Result.error("账号已被锁定,请联系管理员");
|
|
|
- } catch (AuthenticationException e) {
|
|
|
- return Result.error("账户验证失败");
|
|
|
- }
|
|
|
- return Result.success(true, ShiroUtils.getShiroUserInfo());
|
|
|
- }
|
|
|
+// return Result.success(true, ShiroUtils.getShiroUserInfo());
|
|
|
+// }
|
|
|
|
|
|
|
|
|
- @PostMapping("dealer/login")
|
|
|
+ @PostMapping("login")
|
|
|
@ApiImplicitParams({
|
|
|
@ApiImplicitParam(name = "userCode", value = "用户名", example = "xxs2", required = true, dataType = "String", paramType = "query"),
|
|
|
@ApiImplicitParam(name = "password", value = "密码", example = "123456", required = true, dataType = "string", paramType = "query")
|