more validation for registration and added login server-side