|
|
@@ -260,6 +260,7 @@ module.exports = { |
|
|
|
|
|
|
|
if (credentials.username === '' || credentials.password === '') { |
|
|
|
msg.callback(messages.login.allFields); |
|
|
|
|
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
@@ -279,6 +280,18 @@ module.exports = { |
|
|
|
msg.callback(messages.login.incorrect); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
const emBeforeLogin = { |
|
|
|
obj: this.obj, |
|
|
|
success: true, |
|
|
|
msg: null |
|
|
|
}; |
|
|
|
await eventEmitter.emit('onBeforeLogin', emBeforeLogin); |
|
|
|
if (!emBeforeLogin.success) { |
|
|
|
msg.callback(emBeforeLogin.msg); |
|
|
|
|
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
this.username = username; |
|
|
|
await cons.logOut(this.obj); |
|
|
|