Michael Elsdörfer  committed 9d09b93

The Backend.activate method can now return extra context to be used by the view. This allows a custom backend to implement an activation process in which the user is provided with a form to enter the activiation key, rather than it needing to be passed through the url.

  • Participants
  • Parent commits b8fc294
  • Branches default

Comments (0)

Files changed (2)

File registration/backends/default/

         Given an an activation key, look up and activate the user
         account corresponding to that key (if possible).
+        The return value should be a 2-tuple (new-user, extra_context).
+        ``None`` can be given for the user if activation failed.
         After successful activation, the signal
         ``registration.signals.user_activated`` will be sent, with the
         newly activated ``User`` as the keyword argument ``user`` and
-        return activated
+        return activated, {}
     def registration_allowed(self, request):

File registration/

     backend = get_backend(backend)
-    account = backend.activate(request, **kwargs)
+    account, backend_ctx = backend.activate(request, **kwargs)
     if account:
         if on_success:
         'expiration_days': settings.ACCOUNT_ACTIVATION_DAYS,
+    kwargs.update(backend_ctx)
     return render_to_response(template_name,