Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fixed #897 by only accessing request.POST in the middleware when we're pr #924

Merged
merged 1 commit into from

2 participants

@ojii
Collaborator

Fixed #897 by only accessing request.POST in the middleware when we're pretty sure the POST is for the toolbar (login)

@ojii ojii Fixed #897 by only accessing request.POST in the middleware when we'r…
…e pretty sure the POST is for the toolbar (login)
932f7ec
@chrisglass chrisglass commented on the diff
cms/templates/cms/toolbar/items/login.html
@@ -1,5 +1,5 @@
{% load i18n %}
-<form action="." method="post" id="cms_toolbar-item_login" class="cms_toolbar-item{% if auth_error %} cms_toolbar_error{% endif %}">
+<form action="?cms-toolbar-login=1" method="post" id="cms_toolbar-item_login" class="cms_toolbar-item{% if auth_error %} cms_toolbar_error{% endif %}">
@chrisglass Collaborator

Not the most elegant fix - but it works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@chrisglass chrisglass merged commit 759ddbf into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 4, 2011
  1. @ojii

    Fixed #897 by only accessing request.POST in the middleware when we'r…

    ojii authored
    …e pretty sure the POST is for the toolbar (login)
This page is out of date. Refresh to see the latest.
Showing with 10 additions and 9 deletions.
  1. +9 −8 cms/cms_toolbar.py
  2. +1 −1  cms/templates/cms/toolbar/items/login.html
View
17 cms/cms_toolbar.py
@@ -219,11 +219,12 @@ def _request_hook_get(self):
def _request_hook_post(self):
# login hook
- login_form = CMSToolbarLoginForm(self.request.POST)
- if login_form.is_valid():
- username = login_form.cleaned_data['cms_username']
- password = login_form.cleaned_data['cms_password']
- user = authenticate(username=username, password=password)
- if user:
- login(self.request, user)
- self.init()
+ if 'cms-toolbar-login' in self.request.GET:
+ login_form = CMSToolbarLoginForm(self.request.POST)
+ if login_form.is_valid():
+ username = login_form.cleaned_data['cms_username']
+ password = login_form.cleaned_data['cms_password']
+ user = authenticate(username=username, password=password)
+ if user:
+ login(self.request, user)
+ self.init()
View
2  cms/templates/cms/toolbar/items/login.html
@@ -1,5 +1,5 @@
{% load i18n %}
-<form action="." method="post" id="cms_toolbar-item_login" class="cms_toolbar-item{% if auth_error %} cms_toolbar_error{% endif %}">
+<form action="?cms-toolbar-login=1" method="post" id="cms_toolbar-item_login" class="cms_toolbar-item{% if auth_error %} cms_toolbar_error{% endif %}">
@chrisglass Collaborator

Not the most elegant fix - but it works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
<fieldset>
{% csrf_token %}
<label for="cms_toolbar-item_login-username">{% trans "Username" %}</label>
Something went wrong with that request. Please try again.