added black box business logic to the login and reg endpoints