Properly setting user identity on login