Event handler for login not working