summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPrimal Pappachan2012-03-15 17:59:36 +0530
committerPrimal Pappachan2012-03-15 17:59:36 +0530
commitbad8e4d23b4c3ea19bcb3b295a8c16363f49919b (patch)
treec813e9de4d05727aca72336e665936f17d9b963c
parentb2388840bd935f170f6f54f7e27401971552521f (diff)
downloadaloha-bad8e4d23b4c3ea19bcb3b295a8c16363f49919b.tar.gz
aloha-bad8e4d23b4c3ea19bcb3b295a8c16363f49919b.tar.bz2
aloha-bad8e4d23b4c3ea19bcb3b295a8c16363f49919b.zip
Fixed the authentication problem
-rw-r--r--allotter/forms.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/allotter/forms.py b/allotter/forms.py
index b6a3949..8d4d021 100644
--- a/allotter/forms.py
+++ b/allotter/forms.py
@@ -59,15 +59,14 @@ class UserLoginForm(forms.Form):
u_name, pwd = self.cleaned_data.get('username'), self.cleaned_data.get('password')
dob = self.cleaned_data['dob']
try:
- user = User.objects.get(username__exact = u_name)
- profile = user.get_profile()
- if profile.dob == dob:
- return dob
+ current_user = User.objects.get(username__exact = u_name)
+ profile = current_user.get_profile()
+ if profile.dob != dob:
+ raise forms.ValidationError("Date of Birth doesn't match.")
except User.DoesNotExist:
raise forms.ValidationError("Verify the details entered.")
- raise forms.ValidationError("Date of Birth doesn't match.")
-
+
##Authentication part
user = authenticate(username = u_name, password = pwd)
if not user: