I just installed the django all-auth module and my problem is that the user session is always false
. user.is_authenticated
always gives me false
. I sign up and login with my credentials and get redirected to the REDIRECT_URL
. If I go to the accounts/login
page now, I get redirected to the REDIRECT_URL
, again. This is till I logout using accounts/logout
. So I am actually logged in, but user.is_authenticated
is not working. Thankful for any help.
There I have this simple code:
{% if user.is_authenticated %}
Welcome back {{ user.email }}
{% else %}
You are not logged in
{% endif %}
Settings.py (allauth settings):
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_UNIQUE_EMAIL = True
#ACCOUNT_EMAIL_VERIFICATION = 'mandatory'
ACCOUNT_EMAIL_VERIFICATION = ("none")
ACCOUNT_USERNAME_REQUIRED = False
ACCOUNT_AUTHENTICATION_METHOD = 'email'
LOGIN_REDIRECT_URL = 'http://localhost:8000/app/'
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
The Problem was, I was not using the render
function, which includes the requestContext
parameter, I was missing. Now everything works fine. Thanks alot for support.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.