aboutsummaryrefslogtreecommitdiffstats
path: root/servo
diff options
context:
space:
mode:
authorFilipp Lepalaan <filipp@mac.com>2017-01-19 18:22:55 +0200
committerFilipp Lepalaan <filipp@mac.com>2017-01-19 18:22:55 +0200
commitef376c2cf80cb89c3c5a5dc79c39c5045406b5e7 (patch)
tree4848c1b1996d1d7843e1dea6d4e270a85c621226 /servo
parente9903924542441fd0839a8e4f649f32f26d10d13 (diff)
downloadServo-ef376c2cf80cb89c3c5a5dc79c39c5045406b5e7.tar.gz
Servo-ef376c2cf80cb89c3c5a5dc79c39c5045406b5e7.tar.bz2
Servo-ef376c2cf80cb89c3c5a5dc79c39c5045406b5e7.zip
Added cookie testing to login page
Diffstat (limited to 'servo')
-rw-r--r--servo/views/account.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/servo/views/account.py b/servo/views/account.py
index 38e63c4..9f0da54 100644
--- a/servo/views/account.py
+++ b/servo/views/account.py
@@ -83,14 +83,18 @@ def orders(request):
def login(request):
- """
- User trying to log in
- """
+ """User trying to log in."""
title = _("Sign In")
form = LoginForm()
if 'username' in request.POST:
+ if request.session.test_cookie_worked():
+ request.session.delete_test_cookie()
+ else:
+ error = {'message': _('Please enable cookies to use this system')}
+ return render(request, 'checkin/error.html', error)
+
form = LoginForm(request.POST)
if form.is_valid():
@@ -120,6 +124,7 @@ def login(request):
else:
messages.error(request, _("Invalid input for login"))
+ request.session.set_test_cookie()
return render(request, "accounts/login.html", locals())