Commit a5ddd90d by Tom Christie

Log in and log out require escape and mark_safe

parent 24a2c3f5
...@@ -41,8 +41,9 @@ def optional_login(request): ...@@ -41,8 +41,9 @@ def optional_login(request):
except NoReverseMatch: except NoReverseMatch:
return '' return ''
snippet = "<li><a href='{href}?next={next}'>Log in</a></li>".format(href=login_url, next=escape(request.path)) snippet = "<li><a href='{href}?next={next}'>Log in</a></li>"
return snippet snippet = snippet.format(href=login_url, next=escape(request.path))
return mark_safe(snippet)
@register.simple_tag @register.simple_tag
...@@ -64,8 +65,8 @@ def optional_logout(request, user): ...@@ -64,8 +65,8 @@ def optional_logout(request, user):
<li><a href='{href}?next={next}'>Log out</a></li> <li><a href='{href}?next={next}'>Log out</a></li>
</ul> </ul>
</li>""" </li>"""
snippet = snippet.format(user=escape(user), href=logout_url, next=escape(request.path))
return snippet.format(user=user, href=logout_url, next=escape(request.path)) return mark_safe(snippet)
@register.simple_tag @register.simple_tag
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment