User auth refactoring