comparison views.py @ 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 a5547f079190
children
comparison
equal deleted inserted replaced
163:fba603bfcff8 168:c494e6ecff58
31 username = request.POST.get('username', '') 31 username = request.POST.get('username', '')
32 password = request.POST.get('password1', '') 32 password = request.POST.get('password1', '')
33 33
34 if username and password: 34 if username and password:
35 user = authenticate(username=username, password=password) 35 user = authenticate(username=username, password=password)
36 login(request, user)
37 36
38 return redirect(next_url) 37 if user is not None:
38 login(request, user)
39 return redirect(next_url)
40
41 # Could not authenticate
42 form = {
43 'username': {
44 'errors': 'Your username and password did not match.',
45 }
46 }
39 else: 47 else:
40 form = { 48 form = {
41 'password1': { 49 'password1': {
42 'errors': 'Please enter a username and password.', 50 'errors': 'Please enter a username and password.',
43 }, 51 },