From 5c119768e1d90852ed6753239b95dbc427426733 Mon Sep 17 00:00:00 2001 From: undefined Date: Tue, 24 Mar 2026 13:58:40 +0800 Subject: [PATCH] core: only trigger auth log for non-guest --- packages/hydrooj/src/handler/user.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/hydrooj/src/handler/user.ts b/packages/hydrooj/src/handler/user.ts index 68c7057b8..ba8dbd126 100644 --- a/packages/hydrooj/src/handler/user.ts +++ b/packages/hydrooj/src/handler/user.ts @@ -31,7 +31,7 @@ import { } from '../service/server'; async function successfulAuth(this: Handler, udoc: User) { - await user.setById(udoc._id, { loginat: new Date(), loginip: this.request.ip }); + if (udoc._id !== 0) await user.setById(udoc._id, { loginat: new Date(), loginip: this.request.ip }); this.context.HydroContext.user = udoc; this.session.viewLang = ''; this.session.uid = udoc._id; @@ -40,7 +40,7 @@ async function successfulAuth(this: Handler, udoc: User) { this.session.scope = PERM.PERM_ALL.toString(); this.session.oauthBind = null; this.session.recreate = true; - await oplog.log(this, 'user.loginSuccess', { uid: udoc._id }); + if (udoc._id !== 0) await oplog.log(this, 'user.loginSuccess', { uid: udoc._id }); } class UserLoginHandler extends Handler {