diff --git a/pedasi/settings.py b/pedasi/settings.py index 174bf975c4e86d58555365e1cfff9d2f5b891cea..4ab252cc275bd0c555f63291a96417d5a85fa6ee 100644 --- a/pedasi/settings.py +++ b/pedasi/settings.py @@ -231,8 +231,8 @@ SOCIAL_AUTH_PIPELINE = [ # 'social_core.pipeline.social_auth.associate_by_email', # Create a user account if we haven't found one yet. - 'social_core.pipeline.user.create_user', - # 'profiles.social_auth.create_user_disabled', + # 'social_core.pipeline.user.create_user', + 'profiles.social_auth.create_user_disabled', # Create the record that associates the social account with the user. 'social_core.pipeline.social_auth.associate_user', diff --git a/profiles/social_auth.py b/profiles/social_auth.py index b4d320fc414d66500d14aa5320443f2a3174c39c..18171507b5cf46669e425d65aa4d830bba27338a 100644 --- a/profiles/social_auth.py +++ b/profiles/social_auth.py @@ -1,7 +1,18 @@ +""" +Module containing customisations to the Python Social Auth pipeline. + +See https://python-social-auth.readthedocs.io/en/latest/ +""" + from social_core.pipeline.user import create_user def create_user_disabled(strategy, details, backend, user=None, *args, **kwargs): + """ + Create a user account for the user being authenticated - but mark it as disabled. + + A new user must have their account enabled by an admin before they are able to log in. + """ # Returns dict containing 'is_new' and 'user' result = create_user(strategy, details, backend, user, *args, **kwargs)