From ff8df6916de86e037b0f8f37a8b29ad0437e5348 Mon Sep 17 00:00:00 2001
From: silum <deneys.maartens@gmail.com>
Date: Sat, 04 Nov 2017 19:51:12 +0100
Subject: [PATCH] views.py: prevent exception on unknown user login

---
 docs/quick_tutorial/authentication/tutorial/views.py |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/docs/quick_tutorial/authentication/tutorial/views.py b/docs/quick_tutorial/authentication/tutorial/views.py
index b07538d..b2d9354 100644
--- a/docs/quick_tutorial/authentication/tutorial/views.py
+++ b/docs/quick_tutorial/authentication/tutorial/views.py
@@ -43,7 +43,8 @@
         if 'form.submitted' in request.params:
             login = request.params['login']
             password = request.params['password']
-            if check_password(password, USERS.get(login)):
+            hashed_pw = USERS.get(login)
+            if hashed_pw and check_password(password, hashed_pw):
                 headers = remember(request, login)
                 return HTTPFound(location=came_from,
                                  headers=headers)

--
Gitblit v1.9.3