Hi all,
I'm using django-registration 0.6 to handle user account creation:
http://code.google.com/p/django-registration/
When the user activates their account (by following the activation link that
they are emailed), what I'd like is for them to be logged in right away. As
far as I can tell, this is not currently supported.
Has anyone found a way to make this happen? One approach would be to wrap the
activate view in a custom view, that also logs the user in - something like:
{{{
from django.contrib.auth import authenticate, login
from registration.models import RegistrationProfile
from registration.views import activate
def activate(request, activation_key):
'''
Wrapper around registration module's activate view, which logs in user
'''
prior = RegistrationProfile.objects.get(activation_key=activation_key)
resp = activate(request, activation_key)
after = RegistrationProfile.objects.get(user=prior.user)
# The activation key is reset to the string "ACTIVATION_KEY" if
# the activation is successful
if after.activation_key != activation_key:
# user account has been activated
login(request, after.user)
return resp
}}}
Unfortunately this does not work: django.contrib.auth.login requires that
authenticate() be successfully called first. Within the view here, though, I
don't have the password - the salted hash is stored in the User database, but
not the plain password, which is what authenticate requires.
Suggestions appreciated!
Thanks,
Aaron
--
Aaron Maxwell
http://redsymbol.net
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---