From c3757f5f74b4c45d8f295bee01317378f77d0b8b Mon Sep 17 00:00:00 2001
From: James Graham <J.Graham@software.ac.uk>
Date: Wed, 27 Feb 2019 11:29:02 +0000
Subject: [PATCH] Re-enable functionality to start new user accounts as
 disabled

---
 pedasi/settings.py      |  4 ++--
 profiles/social_auth.py | 11 +++++++++++
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/pedasi/settings.py b/pedasi/settings.py
index 174bf97..4ab252c 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 b4d320f..1817150 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)
 
-- 
GitLab