logic of register/login form