def validate_email(self, field): ''' Custom validator for the email, make sure that it is not already used. :param field: Field object, the email string is in field.data ''' customer = CustomerService.get_customer_by_email(field.data) if customer is not None: raise ValidationError('Email address already taken.')
def validate_email(self, field): ''' Custom validator for the email, make sure that it is not already used. :param field: Field object, the email string is in field.data ''' customer = CustomerService.get_customer_by_email(field.data) if customer is not None: raise ValidationError( 'Email address already taken.' )
def check_auth(username, password): ''' This function is called to check if a username / password combination is valid. :param username: The email address used in the basic auth field :param password: The password used in the basic auth field ''' customer = CustomerService.get_customer_by_email(username) if customer is not None: if customer.check_password(password): g.customer = customer return True return False