+ User login and logoff events
This commit is contained in:
parent
c142a9c3d3
commit
0ae9d0d143
|
@ -100,6 +100,10 @@ function removeClient(client) {
|
||||||
'Client disconnected'
|
'Client disconnected'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if(client.user && client.user.isValid()) {
|
||||||
|
Events.emit(Events.getSystemEvents().UserLogoff, { user : client.user } );
|
||||||
|
}
|
||||||
|
|
||||||
Events.emit(
|
Events.emit(
|
||||||
Events.getSystemEvents().ClientDisconnected,
|
Events.getSystemEvents().ClientDisconnected,
|
||||||
{ client : client, connectionCount : clientConnections.length }
|
{ client : client, connectionCount : clientConnections.length }
|
||||||
|
|
|
@ -67,7 +67,8 @@ module.exports = class User {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.properties.pw_pbkdf2_salt.length === User.PBKDF2.saltLen * 2 && this.prop_name.pw_pbkdf2_dk.length === User.PBKDF2.keyLen * 2;
|
return ((this.properties.pw_pbkdf2_salt.length === User.PBKDF2.saltLen * 2) &&
|
||||||
|
(this.properties.pw_pbkdf2_dk.length === User.PBKDF2.keyLen * 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
isRoot() {
|
isRoot() {
|
||||||
|
|
|
@ -6,6 +6,7 @@ const setClientTheme = require('./theme.js').setClientTheme;
|
||||||
const clientConnections = require('./client_connections.js').clientConnections;
|
const clientConnections = require('./client_connections.js').clientConnections;
|
||||||
const StatLog = require('./stat_log.js');
|
const StatLog = require('./stat_log.js');
|
||||||
const logger = require('./logger.js');
|
const logger = require('./logger.js');
|
||||||
|
const Events = require('./events.js');
|
||||||
|
|
||||||
// deps
|
// deps
|
||||||
const async = require('async');
|
const async = require('async');
|
||||||
|
@ -59,6 +60,8 @@ function userLogin(client, username, password, cb) {
|
||||||
client.log = logger.log.child( { clientId : client.log.fields.clientId, username : user.username });
|
client.log = logger.log.child( { clientId : client.log.fields.clientId, username : user.username });
|
||||||
client.log.info('Successful login');
|
client.log.info('Successful login');
|
||||||
|
|
||||||
|
Events.emit(Events.getSystemEvents().UserLogin, { user } );
|
||||||
|
|
||||||
async.parallel(
|
async.parallel(
|
||||||
[
|
[
|
||||||
function setTheme(callback) {
|
function setTheme(callback) {
|
||||||
|
|
Loading…
Reference in New Issue