Implement login/logout through events