def validate_email(self, email): if email.data != current_user.email: user = User.objects(email=email.data).first() if user: raise ValidationError( 'That email is taken. Please choose a different one.')
def validate_email(self, email): user = User.objects(email=email.data).first() if user is None: raise ValidationError( 'There is no account with that email. You must register first.' )
def validate_username(self, username): if username.data != current_user.username: user = User.objects(username=username.data).first() if user: raise ValidationError( 'That username is taken. Please choose a different one.')