Updated the login hook