login on activation with django-registration

1
2
3
4
def login_on_activation(sender, user, request, **kwargs):
    user.backend='django.contrib.auth.backends.ModelBackend' 
    login(request,user)
user_activated.connect(login_on_activation)

More like this

  1. Django Registration without username by newmaniese 3 years, 10 months ago
  2. Using manager methods by ubernostrum 4 years, 11 months ago
  3. Trigger a user password change by jedie 4 years, 5 months ago
  4. Log in a user without requiring credentials by SmileyChris 2 years, 8 months ago
  5. Simple E-mail registration by bthomas 3 years, 2 months ago

Comments

ericcolon (on March 17, 2010):

I was just looking for this. Thanks.

#

robhudson (on March 23, 2010):

Just a note: This requires the unreleased version of django-registration. The version that's released on PyPI (and that you will get via pip), doesn't appear to emit signals.

#

rich00 (on December 10, 2010):

Need a little help? What is 'sender' in this function? My thoughts were to call this function from with the registration.activate view.

#

(Forgotten your password?)