Login and Logout Function Updated