mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: only trigger auth log for non-guest
This commit is contained in:
1 file changed
+2
-2
@@ -31,7 +31,7 @@ import {
|
|||||||
} from '../service/server';
|
} from '../service/server';
|
||||||
|
|
||||||
async function successfulAuth(this: Handler, udoc: User) {
|
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.context.HydroContext.user = udoc;
|
||||||
this.session.viewLang = '';
|
this.session.viewLang = '';
|
||||||
this.session.uid = udoc._id;
|
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.scope = PERM.PERM_ALL.toString();
|
||||||
this.session.oauthBind = null;
|
this.session.oauthBind = null;
|
||||||
this.session.recreate = true;
|
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 {
|
class UserLoginHandler extends Handler {
|
||||||
|
|||||||
Reference in new issue
Block a user