changeset 168:c494e6ecff58

Fix bug in logging in with incorrect credentials
author dellsystem <ilostwaldo@gmail.com>
date Sat, 20 Oct 2012 00:16:38 -0400
parents fba603bfcff8
children 9565b494b989
files views.py
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/views.py	Mon Oct 15 02:43:30 2012 -0400
+++ b/views.py	Sat Oct 20 00:16:38 2012 -0400
@@ -33,9 +33,17 @@
 
             if username and password:
                 user = authenticate(username=username, password=password)
-                login(request, user)
+
+                if user is not None:
+                    login(request, user)
+                    return redirect(next_url)
 
-                return redirect(next_url)
+                # Could not authenticate
+                form = {
+                    'username': {
+                        'errors': 'Your username and password did not match.',
+                    }
+                }
             else:
                 form = {
                     'password1': {