Skip to content

Commit

Permalink
docs(users): Add docstring to the superuser_creation signal
Browse files Browse the repository at this point in the history
  • Loading branch information
ERosendo committed Jun 21, 2023
1 parent bebd562 commit 1aba9f9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions bc/users/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 1aba9f9

Please sign in to comment.