Add a custom version of user_passes_test to avoid infinite redirection loops