SHARE
TWEET

Untitled

a guest Aug 12th, 2017 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class LoginForm(forms.Form):
  2.     log_username = forms.CharField(required=True,min_length=5,label="E-mail")
  3.     password = forms.CharField( widget=forms.PasswordInput(render_value=False), label="Hasło",min_length=6,required=True),
  4.  
  5.     def clean(self):
  6.         username = request.POST['log_username']
  7.         password = request.POST['password']
  8.         user = authenticate(username=username, password=password)
  9.         if user is None:
  10.             raise forms.ValidationError((u'Cos zle wpisales.'))
  11.         return self.cleaned_data
RAW Paste Data
Top