stevenpi / Link.Python.Django.DiyBlog

This blog is based on the assessment found [here](https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django/django_assessment_blog).
MIT License
0 stars 0 forks source link

Check if current user is authenticated #40

Closed mbaechtold closed 6 years ago

mbaechtold commented 6 years ago

There are 4 occurrences of {% if user.is_authenticated %} in several templates. This only works if the context contains user and user is the authenticated user extracted from the request in a view and injected into the context.

You most probably want to check for {% if request.user.is_authenticated %} instead. This would be less error prone.