enhance registration and login logic