diff --git a/src/index.js b/src/index.js index 8c953f5e8..ef34b2cb2 100644 --- a/src/index.js +++ b/src/index.js @@ -481,6 +481,12 @@ const setUpConsoleProxy = (webServer, xo) => { if (!await xo.hasPermissions(user.id, [ [ id, 'operate' ] ])) { // eslint-disable-line space-before-keywords throw new InvalidCredential() } + + const { remoteAddress } = socket + debug('+ Console proxy (%s - %s)', user.name, remoteAddress) + socket.on('close', () => { + debug('- Console proxy (%s - %s)', user.name, remoteAddress) + }) } const xapi = xo.getXAPI(id, ['VM', 'VM-controller']) diff --git a/src/xo.js b/src/xo.js index 293f67f12..a104fbdea 100644 --- a/src/xo.js +++ b/src/xo.js @@ -369,7 +369,13 @@ export default class Xo extends EventEmitter { // TODO: this method will no longer be async when users are // integrated to the main collection. async getUser (id) { - return (await this._getUser(id)).properties + const user = (await this._getUser(id)).properties + + // TODO: remove when no longer the email property has been + // completely eradicated. + user.name = user.email + + return user } async getUserByName (username, returnNullIfMissing) {