<http://docs.djangoproject.com/en/dev/topics/email/>`_ for details).
Begin by adding ``registration`` to the ``INSTALLED_APPS`` setting of
your project, and specifying one additional setting:
that period, the account will remain permanently inactive and may
be deleted by maintenance scripts provided in django-registration.
+ Optional. If this is `True`, your users will automatically log in when they
+ click on the activation link in their email. Defaults to `False`.
For example, you might have something like the following in your
ACCOUNT_ACTIVATION_DAYS = 7 # One-week activation window; you may, of course, use a different value.
+ REGISTRATION_AUTO_LOGIN = True # Automatically log the user in.
Once you've done this, run ``manage.py syncdb`` to install the model
used by the default setup.
+from django.conf import settings
+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):
+ if settings.get('REGISTRATION_AUTO_LOGIN', False):
+ backend = get_backends() # A bit of a hack to bypass `authenticate()`.
+ user.backend = "%s.%s" % (backend.__module__, backend.__class__.__name__)