Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class LoginForm(forms.Form):
- log_username = forms.CharField(required=True,min_length=5,label="E-mail")
- password = forms.CharField( widget=forms.PasswordInput(render_value=False), label="Hasło",min_length=6,required=True),
- def clean(self):
- username = request.POST['log_username']
- password = request.POST['password']
- user = authenticate(username=username, password=password)
- if user is None:
- raise forms.ValidationError((u'Cos zle wpisales.'))
- return self.cleaned_data
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement