mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
core: fix login redirect (#186)
This commit is contained in:
1 parent
7377bfadb0
commit
2495f23192
1 file changed
+2
-1
@@ -27,6 +27,7 @@ import {
|
||||
UserFacingError, ValidationError, PrivilegeError,
|
||||
CsrfTokenError, InvalidOperationError, MethodNotAllowedError,
|
||||
NotFoundError, HydroError, SystemError,
|
||||
LoginError,
|
||||
} from '../error';
|
||||
import { isContent, isName, isTitle } from '../lib/validator';
|
||||
import avatar from '../lib/avatar';
|
||||
@@ -650,7 +651,7 @@ export class Handler extends HandlerCommon {
|
||||
logger.error(`User: ${this.user._id}(${this.user.uname}) Path: ${this.request.path}`, error.msg(), error.params);
|
||||
if (error.stack) logger.error(error.stack);
|
||||
}
|
||||
if (this.user?._id === 0) {
|
||||
if (this.user?._id === 0 && !(error instanceof LoginError)) {
|
||||
this.response.redirect = this.url('user_login', { query: { redirect: this.request.path + this.ctx.search } });
|
||||
} else {
|
||||
this.response.status = error instanceof UserFacingError ? error.code : 500;
|
||||
|
||||
Reference in new issue
Block a user