mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: reject access to /user/0
This commit is contained in:
1 parent
9bfa60169b
commit
50b8343ad9
2 files changed
+3
-2
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hydrooj",
|
||||
"version": "2.24.2",
|
||||
"version": "2.24.3",
|
||||
"bin": "bin/hydrooj.js",
|
||||
"main": "dist/loader.js",
|
||||
"typings": "dist/loader.d.ts",
|
||||
|
||||
@@ -2,7 +2,7 @@ import moment from 'moment-timezone';
|
||||
import {
|
||||
UserAlreadyExistError, InvalidTokenError, VerifyPasswordError,
|
||||
UserNotFoundError, SystemError, BlacklistedError,
|
||||
UserFacingError, LoginError,
|
||||
UserFacingError, LoginError, NotFoundError,
|
||||
} from '../error';
|
||||
import { User } from '../interface';
|
||||
import {
|
||||
@@ -178,6 +178,7 @@ class UserLostPassWithCodeHandler extends Handler {
|
||||
class UserDetailHandler extends Handler {
|
||||
@param('uid', Types.Int)
|
||||
async get(domainId: string, uid: number) {
|
||||
if (uid === 0) throw new NotFoundError(this.request.path);
|
||||
const isSelfProfile = this.user._id === uid;
|
||||
const udoc = await user.getById(domainId, uid);
|
||||
if (!udoc) throw new UserNotFoundError(uid);
|
||||
|
||||
Reference in new issue
Block a user