finished authentication system for registration and login