core: only trigger auth log for non-guest

This commit is contained in:
undefined committed 2026-03-24 13:58:40 +08:00
1 parent 410b13d765
commit 5c119768e1
1 file changed
+2 -2
+2 -2
View File
@@ -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 {