1. Nick Meharry
  2. django-registration


Nick Meharry  committed 23088f4

Automatically log the user in after activation.

  • Participants
  • Parent commits fad7080
  • Branches default

Comments (0)

Files changed (1)

File registration/signals.py

View file
  • Ignore whitespace
+from django.contrib.auth import login, get_backends
 from django.dispatch import Signal
 # A user has activated his or her account.
 user_activated = Signal(providing_args=["user", "request"])
+def log_in_user(sender, user, request, **kwargs):
+    backend = get_backends()[0] # A bit of a hack to bypass `authenticate()`.
+    user.backend = "%s.%s" % (backend.__module__, backend.__class__.__name__)
+    login(request, user)