From 1aba9f98b21803bb854a7a73eb7cd22e85ec2345 Mon Sep 17 00:00:00 2001 From: Eduardo Rosendo Date: Wed, 21 Jun 2023 00:27:22 -0400 Subject: [PATCH] docs(users): Add docstring to the superuser_creation signal --- bc/users/signals.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bc/users/signals.py b/bc/users/signals.py index 43a792b0..d7310301 100644 --- a/bc/users/signals.py +++ b/bc/users/signals.py @@ -14,6 +14,13 @@ dispatch_uid="create_superuser_object", ) def superuser_creation(sender, instance, created, **kwargs): + """ + Populates fields related to authentication in the user model for + records created using the createsuperuser command. + + We need to do this to allow superuser accounts to login using the + custom form that implements the ConfirmedEmailAuthenticationForm class. + """ if created and instance.is_superuser: instance.activation_key = sha1_activation_key(instance.username) instance.key_expires = now() + timedelta(days=5)