Improved register/login functionality and test