add utility functions for login / register, to reduce code duplication
in local v oauth strategy register/login logic