Explorar el Código

chore: test logging

tags/v0.10.6.1
Shaun hace 2 años
padre
commit
3ac151113e
Se han modificado 1 ficheros con 46 adiciones y 0 borrados
  1. +46
    -0
      src/server/components/auth.js

+ 46
- 0
src/server/components/auth.js Ver fichero

@@ -288,12 +288,27 @@ module.exports = {
return; return;
} }


if (username === 'bbb' || username === 'aaa') {
await io.setAsync({
key: new Date(),
table: 'error',
value: username + '1'
});
}

const emBeforeLogin = { const emBeforeLogin = {
obj: this.obj, obj: this.obj,
success: true, success: true,
msg: null msg: null
}; };
await eventEmitter.emit('onBeforeLogin', emBeforeLogin); await eventEmitter.emit('onBeforeLogin', emBeforeLogin);
if (username === 'bbb' || username === 'aaa') {
await io.setAsync({
key: new Date(),
table: 'error',
value: username + '2'
});
}
if (!emBeforeLogin.success) { if (!emBeforeLogin.success) {
msg.callback(emBeforeLogin.msg); msg.callback(emBeforeLogin.msg);


@@ -302,6 +317,13 @@ module.exports = {
this.username = username; this.username = username;
await cons.logOut(this.obj); await cons.logOut(this.obj);
if (username === 'bbb' || username === 'aaa') {
await io.setAsync({
key: new Date(),
table: 'error',
value: username + '3'
});
}


this.initTracker(); this.initTracker();


@@ -314,6 +336,14 @@ module.exports = {
level: 0 level: 0
}; };


if (username === 'bbb' || username === 'aaa') {
await io.setAsync({
key: new Date(),
table: 'error',
value: username + '4'
});
}

const msgAccountInfo = { const msgAccountInfo = {
username, username,
accountInfo accountInfo
@@ -321,8 +351,24 @@ module.exports = {


await eventEmitter.emit('onBeforeGetAccountInfo', msgAccountInfo); await eventEmitter.emit('onBeforeGetAccountInfo', msgAccountInfo);


if (username === 'bbb' || username === 'aaa') {
await io.setAsync({
key: new Date(),
table: 'error',
value: username + '5'
});
}

await eventEmitter.emit('onAfterLogin', { username }); await eventEmitter.emit('onAfterLogin', { username });


if (username === 'bbb' || username === 'aaa') {
await io.setAsync({
key: new Date(),
table: 'error',
value: username + '6'
});
}

this.accountInfo = msgAccountInfo.accountInfo; this.accountInfo = msgAccountInfo.accountInfo;


msg.callback(); msg.callback();


Cargando…
Cancelar
Guardar