|
@@ -2,6 +2,8 @@ package com.fd.controller;
|
|
|
|
|
|
import com.fd.util.R;
|
|
|
import org.apache.shiro.ShiroException;
|
|
|
+import org.apache.shiro.authc.IncorrectCredentialsException;
|
|
|
+import org.apache.shiro.authc.UnknownAccountException;
|
|
|
import org.apache.shiro.authz.UnauthorizedException;
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
|
@@ -38,6 +40,22 @@ public class ExceptionController {
|
|
|
}
|
|
|
|
|
|
|
|
|
+// @ExceptionHandler(ShiroException.class)
|
|
|
+// public R doHandleShiroException(ShiroException e) {
|
|
|
+// R r = null;
|
|
|
+// if (e instanceof UnknownAccountException) {
|
|
|
+// r = new R(40001, "此账户不存在");
|
|
|
+// } else if (e instanceof IncorrectCredentialsException) {
|
|
|
+// r = new R(40001, "密码不正确");
|
|
|
+// } else {
|
|
|
+// r = new R(40001, e.getMessage());
|
|
|
+//
|
|
|
+// }
|
|
|
+//
|
|
|
+// return r;
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
|