Please help me fix my website
Go to solution
Solved by C2dan88,
The user is being logged out is because In your header for the Account sub-menu you have malformed html for handling the logout button. You fail to close the form in layout.html
... {% if user.is_authenticated %} <form method="POST" action="{%url 'logout'%}" class="accounts"> {% csrf_token %} <lt><a href="{%url 'profile'%}">My Profile</a></lt> <li><button type="submit" class="accounts logout" >Logout</button></li> {% else %} <li><a href="{% url 'login' %}" class="accounts">Login</a></li> <li><a href="{% url 'signup' %}" class="accounts">Sign Up</a></li> {% endif %} ....
You need a closing </form> tag before the {% else %}
Without it the form action for updating the profile picture will be ignored by the browser. This is why the user is logged out when updating the picture.
But typically you logout users from a link not from a form.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now