def check_email(form, field): ok = True if not check_email_format(field.data): field.errors.append('Please enter a valid email address.') ok = False result = FlicketUser.query.filter_by(email=form.email.data).count() if result > 0: field.errors.append('A user with this email address has already registered.') ok = False return ok
def check_email_formatting(form, field): """ Checks formatting of email and also checks that a user is not already registered with the same email address :param form: :param field: :return: """ ok = True if not check_email_format(form.email_address.data): field.errors.append( 'Please enter a correctly formatted email address.') ok = False return ok
def check_email(form, field): """ Checks formatting of email and also checks that a user is not already registered with the same email address :param form: :param field: :return: """ ok = True if not check_email_format(field.data): field.errors.append( 'Please enter a correctly formatted email address.') ok = False result = FlicketUser.query.filter_by(email=form.email.data).count() if result > 0: field.errors.append( 'A user with the email {} is already registered.'.format( form.email.data)) ok = False return ok