def validate(self):
     validated = super(EditUserForm, self).validate()
     if self.name.data != User.make_valid_name(self.name.data):
         self.name.errors.append(
                 'This name has invalid characters. '
                 'Please use letters, numbers, dots and underscores only.')
         validated = False
     return validated
Exemple #2
0
 def validate(self):
     validated = super(EditUserForm, self).validate()
     if self.name.data != User.make_valid_name(self.name.data):
         self.name.errors.append(
             'This name has invalid characters. '
             'Please use letters, numbers, dots and underscores only.')
         validated = False
     return validated
 def validate(self):
     validated = super(CreateUserForm, self).validate()
     if self.name.data != User.make_valid_name(self.name.data):
         self.name.errors.append(
                 'This name has invalid characters. '
                 'Please use letters, numbers, dots and underscores only.')
         validated = False
     user = User.query.filter(User.email==self.email.data).first()
     if user:
         self.email.errors.append('This email is already used.')
         validated = False
     return validated
Exemple #4
0
 def validate(self):
     validated = super(CreateUserForm, self).validate()
     if self.name.data != User.make_valid_name(self.name.data):
         self.name.errors.append(
             'This name has invalid characters. '
             'Please use letters, numbers, dots and underscores only.')
         validated = False
     user = User.query.filter(User.email == self.email.data).first()
     if user:
         self.email.errors.append('This email is already used.')
         validated = False
     return validated
 def validate(self):
     validated = super(ProfileForm, self).validate()
     if self.password.data != self.password_conf.data:
         message = "Passwords aren't the same."
         self.password.errors.append(message)
         self.password_conf.errors.append(message)
         validated = False
     if self.name.data != User.make_valid_name(self.name.data):
         self.name.errors.append(
             'This nickname has '
             'invalid characters. Please use letters, numbers, dots and'
             ' underscores only.')
         validated = False
     return validated