global.authenticated variable needs to be updated

global.authenticated variable needs to be updated correctly on 'loggedin' event.