summaryrefslogtreecommitdiff
path: root/forums/forms.py
diff options
context:
space:
mode:
Diffstat (limited to 'forums/forms.py')
-rw-r--r--forums/forms.py24
1 files changed, 10 insertions, 14 deletions
diff --git a/forums/forms.py b/forums/forms.py
index 90a147d..05f0d56 100644
--- a/forums/forms.py
+++ b/forums/forms.py
@@ -15,33 +15,24 @@ from website.models import Profile
class UserLoginForm(forms.Form):
-
username = forms.CharField()
password = forms.CharField(widget=forms.PasswordInput())
- db = forms.ChoiceField(choices=[('forum', 'forum'), ('scilab', 'scilab'), ('client2', 'client2')])
def clean(self):
cleaned_data = self.cleaned_data
username = cleaned_data.get('username')
+ print username
password = cleaned_data.get('password')
- db = cleaned_data.get('db')
-
+ print password
if username is None or password is None:
raise forms.ValidationError("Invalid username or password")
-
-
- if db == 'forum':
- user = authenticate(username=username, password=password)
- print "default" , "*******************"
- else:
- user = authenticate(username=username, password=password, db=db)
- print db , "*******************"
+ user = authenticate(username=username, password=password)
+
if not user:
raise forms.ValidationError("Invalid username or password")
if not user.is_active:
raise forms.ValidationError("User is blocked")
cleaned_data['user'] = user
-
return cleaned_data
class ProfileForm(forms.ModelForm):
@@ -112,4 +103,9 @@ class RegisterForm(forms.Form):
raise forms.ValidationError(_("This username has already existed."))
except User.DoesNotExist:
pass
- return username
+
+
+
+
+
+