Move user auth logic into its own method