logic - login and register