Guest User

Untitled

a guest
Dec 15th, 2018
380
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.57 KB | None | 0 0
  1. class AuthorizationForm(Form):
  2.     email = TextField(u'Email', [Required()])
  3.     password = PasswordField(u'Password', [Required()])
  4.     go = SubmitField(u'Go')
  5.  
  6.     def validate_email(form, field):
  7.         if not bool(re.match("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$", field.data)):
  8.             raise ValidationError('Name must be not empty')
  9.  
  10.     def validate_password(form, field):
  11.         if not bool(re.match("(?!^[0-9]*$)(?!^[a-zA-Z]*$)^([a-zA-Z0-9]{8,16})$", field.data)):
  12.             raise ValidationError('Name must be not empty')
Add Comment
Please, Sign In to add comment