mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
bump beta.10
This commit is contained in:
27 files changed
+143
-112
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import type { KoaContext } from '@hydrooj/framework';
|
||||
import { PERM } from '../../model/builtin';
|
||||
import { PERM, PRIV } from '../../model/builtin';
|
||||
import UserModel from '../../model/user';
|
||||
|
||||
export default async (ctx: KoaContext, next) => {
|
||||
@@ -13,6 +13,9 @@ export default async (ctx: KoaContext, next) => {
|
||||
user = await UserModel.getById(domainId, ctx.session.uid, ctx.session.scope);
|
||||
}
|
||||
if (user._id === 0) delete user.viewLang;
|
||||
else if (!user._udoc.ip.includes(ctx.request.ip) && user.hasPriv(PRIV.PRIV_USER_PROFILE)) {
|
||||
await UserModel.setById(user._id, { loginip: ctx.request.ip });
|
||||
}
|
||||
ctx.HydroContext.user = await user.private();
|
||||
await next();
|
||||
};
|
||||
Reference in new issue
Block a user