Improved login, sign up, and password reset logic