Hello,
I have a custom authentication backend and a custom user model. The
authentication() method in the custom authentication backend returns the
custom user after successful authentication. Once authenticated, I use
login from django.contrib.auth to set the sessionid for the custom user.
Now, I create a method as shown below:
*
def myview(request):
if not request.user.is_authenticated():
return render(request,'auth_fail.html')
else:
return render(request,'auth_success.html')*
This is always returning not authenticated. When I print request.user, it
shows AnonymousUser. But, when i print request.COOKIES, i can see the
sessionid which was set by the login method from django.contrib.auth.
So, my question is how can I check if the custom user is authenticated or
not?.
Thanks in advance.
Best Regards,
Goose.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.