I've been trying to implement the user registration process from
http://www.b-list.org/weblog/2006/09/02/django-tips-user-registration .
It's basically a registration process where the user has to be
activated by clicking on a link in an email. Everything went fine and
it worked. Then I wanted to login automatically after the user clicks
on the link in the email.

I use this view for that:
def confirm(request, activation_key):
    if request.user.is_authenticated():
        return render_to_response('login/confirm.html', {'has_account':
True})
    user_profile = get_object_or_404(UserProfile,
                                     activation_key=activation_key)
    if user_profile.key_expires < datetime.datetime.today():
        return render_to_response('login/confirm.html', {'expired':
True})
    user_account = user_profile.user
    user_account.is_active = True
    user_account.save()
    user = User.objects.get(pk=user_account.id)
    if user is not None:
        login(request, user)
    return render_to_response('login/confirm.html', {'success': True})

I get the following error:
Request Method:         GET
Request URL:
http://localhost:8000/accounts/confirm/080784d003e4cc87d63e0dad2fdcf5ffac3b9de8/
Exception Type: AttributeError
Exception Value: 'User' object has no attribute 'backend'
Exception Location:
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/django/contrib/auth/__init__.py
in login, line 53

The exception is thrown from login(request, user). Can somebody help me
out on this issue?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to