Implementing the login/logout process