Completed login/logout functionality