from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField
import re


phone_regex = "(\+\d+-?)?((\(?\d{3}\)?)|(\d{3}))-?\d{3}-?\d{4}$"

gender_choices = [
    ("", "Gender"),
    ("male", "Male"),
    ("female", "Female"),
    ("other", "Other"),
    ("rns", "Rather Not Say")
]

beginner_choices = [
    ("", "Are you a beginner?"),
    ("yes", "Yes"),
    ("no", "No")
]


ethnicity_choices = [
    ("", "Ethnicity"),
    ("white", "White"),
    ("african_american", "African American"),
    ("asian_pacific", "Asian or Pacific Islander"),
    ("american_indian_alaskan_native", "American Indian or Alaskan Native"),
    ("multiracial", "Multiracial"),
    ("hispanic", "Hispanic origin"),
    ("other", "Other"),
    ("rns", "Rather Not Say")
]

num_hackathons_choices = [
    ("", "How many hackathons have you been to?"),
    ("0", "0"),
    ("1", "1"),
    ("2", "2"),
    ("3", "3"),
    ("4", "4"),
    ("5", "5+")
]

num_hackathons_choices_mentor = [
    ("", "How many hackathons have you mentored at?"),
    ("0", "0"),
    ("1", "1"),
    ("2", "2"),
    ("3", "3"),
    ("4", "4"),
    ("5", "5+")
]

grade_choices = [
    ("", "What grade are you in?"),
    ("9", "9th"),
    ("10", "10th"),
    ("11", "11th"),
    ("12", "12th")
]

shirt_sizes = [
    ("", "What is your shirt size?"),
    ("XS", "Extra Small"),
    ("S", "Small"),
    ("M", "Medium"),
    ("L", "Large"),
    ("XL", "Extra Large")
]

type_account_choices = [
    ("hacker", "Hacker"),
    ("mentor", "Mentor")
]


free_response1_prompt = "Why do you want to come to hackBCA?"

free_response1_prompt_mentor = "Please list languages/frameworks/technologies that you would like to mentor students in."
free_response2_prompt_mentor = "Would you like to run a workshop? If so, please briefly describe your ideas."


class HackerRegistrationForm(Form):
    email = TextField("Email", [
        validators.Required(message = "Enter an email."),
        validators.Email(message = "Invalid email address.")
    ], render_kw={"class": 'text'}, description = "Email")
    first_name = TextField("First Name", [
        validators.Required(message = "You must enter a first name.")
    ], render_kw={"class": 'text'}, description = "First Name")
    last_name = TextField("Last Name", [
        validators.Required(message = "You must enter a last name.")
    ], render_kw={"class": 'text'}, description = "Last Name")

    school = TextField("School Name", [
        validators.Required(message = "Enter your school's name.")
    ], render_kw={"class": 'text'}, description = "School Name")

    gender = SelectField("Gender", [validators.Required(message = "You must select an option.")], choices = gender_choices, render_kw={"class": 'text'}, description = "Gender")
    beginner = SelectField("Are you a beginner?", [validators.Required(message = "You must select an option.")], choices = beginner_choices, render_kw={"class": 'text'}, description = "Are you a beginner?")
    ethnicity = SelectField("Ethnicity", [validators.Required(message = "You must select an option.")], choices = ethnicity_choices, render_kw={"class": 'text'}, description = "Ethnicity")
    grade = SelectField("Grade", [validators.Required(message = "You must select an option.")], choices = grade_choices, render_kw={"class": 'text'}, description = "Grade")
    age = TextField("Age", [
        validators.Required(message = "Enter your age")
    ], render_kw={"class": 'text'}, description = "Age")
    num_hackathons = SelectField("How many hackathons have you attended?", [validators.Required(message = "You must select an option.")], choices = num_hackathons_choices, render_kw={"class": 'text'}, description = "How many hackathons have you attended?")

    free_response1 = TextAreaField(free_response1_prompt, [
        validators.Required(message = "You must answer this question."),
        validators.Length(max = 1500, message = "Response must be less than 1500 characters long.")
    ], render_kw={"class": 'text'}, description = "1500 characters maximum.")

    link1 = TextField("Link #1", [
        validators.optional(),
        validators.URL(message = "Invalid URL.")
    ], render_kw={"class": 'text'}, description = "Link #1 (Optional)")
    link2 = TextField("Link #2", [
        validators.optional(),
        validators.URL(message = "Invalid URL.")
    ], render_kw={"class": 'text'}, description = "Link #2 (Optional)")
    link3 = TextField("Link #3", [
        validators.optional(),
        validators.URL(message = "Invalid URL.")
    ], render_kw={"class": 'text'}, description = "Link #3 (Optional)")
    
    password = PasswordField("Password", [
        validators.Required(message = "You must enter a password."),
        validators.Length(min = 8, message = "Password must be at least 8 characters.")
    ], render_kw={"class": 'text'}, description = "Password")
    confirm_password = PasswordField("Confirm Password", render_kw={"class": 'text'}, description = "Confirm Password")

    mlh_coc = BooleanField("I agree", [
    validators.Required(message = "Please read and agree to the MLH Code of Conduct.")
    ], description = "I have read & agree to the MLH Code of Conduct.", default = False)

    mlh_terms = BooleanField("I agree", [
        validators.Required(message = "Please read and agree to the MLH Terms and Conditions.")
        ], description = "I agree to the MLH Contest Terms and Conditions and the MLH Privacy Policy.", default = False)

    def validate_confirm_password(form, field):
        password = form['password'].data
        if len(password) >= 8 and password != field.data:
            raise ValidationError("Passwords must match.")
    def validate(self): #Man I love validators.URL
        links = ["link1", "link2", "link3"]
        originalValues = {}

        for link in links: #Temporarily prefix all links with http:// if they are missing it
            attr = getattr(self, link)
            val = attr.data
            originalValues[link] = val
            if re.match("^(http|https)://", val) is None:
                val = "http://" + val
            attr.data = val
            setattr(self, link, attr)

        rv = Form.validate(self)

        for link in links: #Revert link values back to actual values
            attr = getattr(self, link)
            attr.data = originalValues[link]
            setattr(self, link, attr)

        if not rv:
            return False
        return True

    def validate_other_gender(form, field):
        if form['gender'].data == 'other' and field.data == "":
            raise ValidationError("Enter your gender.")

class MentorRegistrationForm(Form):
    email = TextField("Email", [
        validators.Required(message = "Enter an email."),
        validators.Email(message = "Invalid email address.")
    ], render_kw={"class": 'text'}, description = "Email")

    first_name = TextField("First Name", [
        validators.Required(message = "You must enter a first name.")
    ], render_kw={"class": 'text'}, description = "First Name")
    
    last_name = TextField("Last Name", [
        validators.Required(message = "You must enter a last name.")
    ], render_kw={"class": 'text'}, description = "Last Name")

    school = TextField("Company/School Name", [
        validators.Required(message = "Enter your company/schools's name.")
    ], render_kw={"class": 'text'}, description = "Company/School Name")

    phone = TextField("Phone Number", [
        validators.Required(message = "Enter your preferred contact number."),
        validators.Regexp(phone_regex, message = "Please enter a valid phone number.")
    ], render_kw={"class": 'text'}, description = "Phone Number")

    num_hackathons = SelectField("How many hackathons have you mentored at?", [validators.Required(message = "You must select an option.")], choices = num_hackathons_choices_mentor, render_kw={"class": 'text'}, description = "How many hackathons have you mentored at?")

    mentor_free_response1 = TextAreaField(free_response1_prompt_mentor, [
        validators.Length(max = 1500, message = "Response must be less than 1500 characters long.")
    ], render_kw={"class": 'text'}, description = "1500 characters maximum.")

    mentor_free_response2 = TextAreaField(free_response2_prompt_mentor, [
        validators.Length(max = 1500, message = "Response must be less than 1500 characters long.")
    ], render_kw={"class": 'text'}, description = "1500 characters maximum.")
    
    github_link = TextField("Github Link", [
        validators.optional(),
        validators.URL(message = "Invalid URL.")
    ], render_kw={"class": 'text'}, description = "Github Link (Optional)")

    linkedin_link = TextField("LinkedIn", [
        validators.optional(),
        validators.URL(message = "Invalid URL.")
    ], render_kw={"class": 'text'}, description = "LinkedIn Link (Optional)")

    site_link = TextField("Personal Site", [
        validators.optional(),
        validators.URL(message = "Invalid URL.")
    ], render_kw={"class": 'text'}, description = "Personal Site Link (Optional)")

    other_link = TextField("other", [
        validators.optional(),
        validators.URL(message = "Invalid URL.")
    ], render_kw={"class": 'text'}, description = "Other Link (Optional)")
 
    password = PasswordField("Password", [
        validators.Required(message = "You must enter a password."),
        validators.Length(min = 8, message = "Password must be at least 8 characters.")
    ], render_kw={"class": 'text'}, description = "Password")
    confirm_password = PasswordField("Confirm Password", render_kw={"class": 'text'}, description = "Confirm Password")

    mlh_coc = BooleanField("I agree", [
    validators.Required(message = "Please read and agree to the MLH Code of Conduct.")
    ], description = "I have read & agree to the MLH Code of Conduct.", default = False)

    mlh_terms = BooleanField("I agree", [
        validators.Required(message = "Please read and agree to the MLH Terms and Conditions.")
        ], description = "I agree to the MLH Contest Terms and Conditions and the MLH Privacy Policy.", default = False)


    def validate(self):
        links = ["github_link", "linkedin_link", "site_link", "other_link"]
        originalValues = {}

        for link in links: #Temporarily prefix all links with http:// if they are missing it
            attr = getattr(self, link)
            val = attr.data
            originalValues[link] = val
            if re.match("^(http|https)://", val) is None:
                val = "http://" + val
            attr.data = val
            setattr(self, link, attr)

        rv = Form.validate(self)

        for link in links: #Revert link values back to actual values
            attr = getattr(self, link)
            attr.data = originalValues[link]
            setattr(self, link, attr)

        if not rv:
            return False
        return True


class LoginForm(Form):
    email = TextField("Email", [
        validators.Required(message = "Enter an email."),
        validators.Email(message = "Invalid email address."
    )], render_kw={"class": 'text'},description = "Email")
    password = PasswordField("Password", [], render_kw={"class": 'text'}, description = "Password")

class EmailForm(Form):
    email = TextField("Email", [
        validators.Required(message = "Enter an email."),
        validators.Email(message = "Invalid email address."
    )], render_kw={"class": 'text'}, description = "Email")



class RecoverForm(Form):
    password = PasswordField("Password", [
        validators.Required(message = "You must enter a password."),
        validators.Length(min = 8, message = "Password must be at least 8 characters.")
    ], render_kw={"class": 'text'}, description = "Password")
    confirm_password = PasswordField("Confirm Password", render_kw={"class": 'text'}, description = "Confirm Password")

    def validate_confirm_password(form, field):
        password = form['password'].data
        if len(password) >= 8 and password != field.data:
            raise ValidationError("Passwords must match.")

class ChangeNameForm(Form):
    first_name = TextField("First Name", [
        validators.Required(message = "You must enter a first name.")
    ], render_kw={"class": 'text'}, description = "First Name")
    last_name = TextField("Last Name", [
        validators.Required(message = "You must enter a last name.")
    ], render_kw={"class": 'text'}, description = "Last Name")

class ChangePasswordForm(Form):
    password = PasswordField("Password", [
        validators.Required(message = "You must enter your current password."),
        validators.Length(min = 8, message = "Password must be at least 8 characters.")
    ], render_kw={"class": 'text'}, description = "Current Password")

    new_password = PasswordField("New Password", [
        validators.Required(message = "You must choose a new password."),
        validators.Length(min = 8, message = "Password must be at least 8 characters.")
    ], render_kw={"class": 'text'}, description = "New Password")
    confirm_password = PasswordField("Confirm New Password", render_kw={"class": 'text'}, description = "Confirm New Password")

    def validate_confirm_password(form, field):
        password = form['new_password'].data
        if len(password) >= 8 and password != field.data:
            raise ValidationError("Passwords must match.")

attending_choices = [
    ("Attending", "Yes, I will!"),
    ("Not Attending", "No, I won't.")
]

class RsvpForm(Form):
    # attending = RadioField("Are you attending hackBCA III?", [validators.Required(message = "Please tell us if you are attending hackBCA III.")], render_kw={"class": 'text'}, choices = attending_choices,  description = "Will you be at hackBCA?")

    # t_shirt_size = SelectField("What is your shirt size?", [validators.Required(message = "You must select an option.")], choices = shirt_sizes, description = "What is your shirt size?")

    dietary_restrictions = TextField("Dietary Restrictions", [
        validators.optional(),
    ], render_kw={"class": 'text'}, description = "Do you have any dietary restrictions?")

    guardian_name = TextField("Guardian Full Name", [
        validators.Required(message = "You must enter a name.")
    ], render_kw={"class": 'text'}, description = "Guardian Name")

    guardian_home_num = TextField("Guardian Home Number", [
        validators.Required(message = "Enter your guardian's home number."),
        validators.Regexp(phone_regex, message = "Please enter a valid phone number.")
    ], render_kw={"class": 'text'}, description = "Guardian Home Number")

    guardian_cell_num = TextField("Guardian Cellphone", [
        validators.Required(message = "Enter your guardian's cellphone number."),
        validators.Regexp(phone_regex, message = "Please enter a valid phone number.")
    ], render_kw={"class": 'text'}, description = "Guardian Cellphone")

    guardian_email = TextField("Guardian Email", [
        validators.Required(message = "Enter an email."),
        validators.Email(message = "Invalid email address."
    )], render_kw={"class": 'text'}, description = "Guardian Email")

    emergency_name = TextField("Emergency Contact Full Name", [
        validators.Required(message = "You must enter a name.")
    ], render_kw={"class": 'text'}, description = "Emergency Contact Name")

    emergency_home_num = TextField("Emergency Contact Home Number", [
        validators.Required(message = "Enter your emergency contact's home number."),
        validators.Regexp(phone_regex, message = "Please enter a valid phone number.")
    ], render_kw={"class": 'text'}, description = "Emergency Contact Home Number")

    emergency_cell_num = TextField("Emergency Contact Cellphone", [
        validators.Required(message = "Enter your emergency contact's cellphone."),
        validators.Regexp(phone_regex, message = "Please enter a valid phone number.")
    ], render_kw={"class": 'text'}, description = "Emergency Contact Cellphone")

    emergency_email = TextField("Emergency Contact Email", [
        validators.Required(message = "Enter an email."),
        validators.Email(message = "Invalid email address."
    )], render_kw={"class": 'text'}, description = "Emergency Contact Email")

    school_address = TextField("School Address", [
         validators.Required(message = "Enter your school address."),
    ], render_kw={"class": 'text'}, description = "School Address")

    school_town = TextField("School Town", [
         validators.Required(message = "Enter your school town."),
    ], render_kw={"class": 'text'}, description = "School Town")

    school_state = TextField("School State", [
         validators.Required(message = "Enter your school state."),
    ], render_kw={"class": 'text'}, description = "School State")

    school_phone_num = TextField("School Phone Number", [
        validators.Required(message = "Enter school's home number."),
        validators.Regexp(phone_regex, message = "Please enter a valid phone number.")
    ], render_kw={"class": 'text'}, description = "School Phone Number")

    school_principal_name = TextField("Principal Name", [
        validators.Required(message = "You must enter a name."),
    ], render_kw={"class": 'text'}, description = "Principal Name")

    school_principal_email = TextField("Principal Email", [
        validators.Required(message = "Enter an email."),
        validators.Email(message = "Invalid email address."
    )], render_kw={"class": 'text'}, description = "Principal Email")

    cs_teacher_name = TextField("CS Teacher Name", [
        validators.optional(),
    ], render_kw={"class": 'text'}, description = "CS Teacher Name (if applicable)")

    cs_teacher_email = TextField("CS Teacher Email", [
        validators.optional(),
        validators.Email(message = "Invalid email address."
    )], render_kw={"class": 'text'}, description = "CS Teacher Email (if applicable)")
# class MentorRsvpForm(Form):
#     attending = RadioField("Are you attending hackBCA III?", [validators.Required(message = "Please tell us if you are attending hackBCA III.")], choices = attending_choices)

#     phone = TextField("Phone Number", [
#         validators.Required(message = "Confirm your preferred contact number."),
#         validators.Regexp(phone_regex, message = "Please enter a valid phone number.")
#     ], description = "Phone Number Confirmation")

#     t_shirt_size = SelectField("What is your shirt size?", [validators.Required(message = "You must select an option.")], choices = shirt_sizes, description = "What is your shirt size?")

#     food_allergies = TextAreaField("Allergies", [
#         validators.optional(),
#     ], description = "Do you have any allergies?")

#     medical_information = TextAreaField("Medical Information", [
#         validators.optional(),
#     ], description = "Are there any other medical issues that we should know about? (ex. Other allergies, illnesses, etc.)")

#     hackbca_rules = BooleanField("I agree",[
#         validators.Required(message = "Please read and agree to our rules.")
#     ], description = "I agree to the rules set forth by hackBCA.", default = False)

#     mlh_terms = BooleanField("I agree",[
#         validators.Required(message = "Please read and agree to the MLH Code of Conduct.")
#     ], description = "I agree to the MLH Code of Conduct.", default = False)


  

    

[((4952, 5051), 'wtforms.PasswordField', 'PasswordField', (['"""Confirm Password"""'], {'render_kw': "{'class': 'text'}", 'description': '"""Confirm Password"""'}), "('Confirm Password', render_kw={'class': 'text'}, description=\n    'Confirm Password')\n", (4965, 5051), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((9625, 9724), 'wtforms.PasswordField', 'PasswordField', (['"""Confirm Password"""'], {'render_kw': "{'class': 'text'}", 'description': '"""Confirm Password"""'}), "('Confirm Password', render_kw={'class': 'text'}, description=\n    'Confirm Password')\n", (9638, 9724), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((11232, 11319), 'wtforms.PasswordField', 'PasswordField', (['"""Password"""', '[]'], {'render_kw': "{'class': 'text'}", 'description': '"""Password"""'}), "('Password', [], render_kw={'class': 'text'}, description=\n    'Password')\n", (11245, 11319), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((11865, 11964), 'wtforms.PasswordField', 'PasswordField', (['"""Confirm Password"""'], {'render_kw': "{'class': 'text'}", 'description': '"""Confirm Password"""'}), "('Confirm Password', render_kw={'class': 'text'}, description=\n    'Confirm Password')\n", (11878, 11964), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((13165, 13271), 'wtforms.PasswordField', 'PasswordField', (['"""Confirm New Password"""'], {'render_kw': "{'class': 'text'}", 'description': '"""Confirm New Password"""'}), "('Confirm New Password', render_kw={'class': 'text'},\n    description='Confirm New Password')\n", (13178, 13271), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((6232, 6251), 'wtforms.Form.validate', 'Form.validate', (['self'], {}), '(self)\n', (6245, 6251), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((10705, 10724), 'wtforms.Form.validate', 'Form.validate', (['self'], {}), '(self)\n', (10718, 10724), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((1949, 1995), 'wtforms.validators.Required', 'validators.Required', ([], {'message': '"""Enter an email."""'}), "(message='Enter an email.')\n", (1968, 1995), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((2007, 2057), 'wtforms.validators.Email', 'validators.Email', ([], {'message': '"""Invalid email address."""'}), "(message='Invalid email address.')\n", (2023, 2057), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((2170, 2229), 'wtforms.validators.Required', 'validators.Required', ([], {'message': '"""You must enter a first name."""'}), "(message='You must enter a first name.')\n", (2189, 2229), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((2345, 2403), 'wtforms.validators.Required', 'validators.Required', ([], {'message': '"""You must enter a last name."""'}), "(message='You must enter a last name.')\n", (2364, 2403), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((2518, 2574), 'wtforms.validators.Required', 'validators.Required', ([], {'message': '"""Enter your school\'s name."""'}), '(message="Enter your school\'s name.")\n', (2537, 2574), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((2679, 2736), 'wtforms.validators.Required', 'validators.Required', ([], {'message': '"""You must select an option."""'}), "(message='You must select an option.')\n", (2698, 2736), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((2871, 2928), 'wtforms.validators.Required', 'validators.Required', ([], {'message': '"""You must select an option."""'}), "(message='You must select an option.')\n", (2890, 2928), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((3069, 3126), 'wtforms.validators.Required', 'validators.Required', ([], {'message': '"""You must select an option."""'}), "(message='You must select an option.')\n", (3088, 3126), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((3250, 3307), 'wtforms.validators.Required', 'validators.Required', ([], {'message': '"""You must select an option."""'}), "(message='You must select an option.')\n", (3269, 3307), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((3426, 3471), 'wtforms.validators.Required', 'validators.Required', ([], {'message': '"""Enter your age"""'}), "(message='Enter your age')\n", (3445, 3471), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((3607, 3664), 'wtforms.validators.Required', 'validators.Required', ([], {'message': '"""You must select an option."""'}), "(message='You must select an option.')\n", (3626, 3664), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((3857, 3918), 'wtforms.validators.Required', 'validators.Required', ([], {'message': '"""You must answer this question."""'}), "(message='You must answer this question.')\n", (3876, 3918), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((3930, 4022), 'wtforms.validators.Length', 'validators.Length', ([], {'max': '(1500)', 'message': '"""Response must be less than 1500 characters long."""'}), "(max=1500, message=\n    'Response must be less than 1500 characters long.')\n", (3947, 4022), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((4144, 4165), 'wtforms.validators.optional', 'validators.optional', ([], {}), '()\n', (4163, 4165), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((4175, 4213), 'wtforms.validators.URL', 'validators.URL', ([], {'message': '"""Invalid URL."""'}), "(message='Invalid URL.')\n", (4189, 4213), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((4331, 4352), 'wtforms.validators.optional', 'validators.optional', ([], {}), '()\n', (4350, 4352), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((4362, 4400), 'wtforms.validators.URL', 'validators.URL', ([], {'message': '"""Invalid URL."""'}), "(message='Invalid URL.')\n", (4376, 4400), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((4518, 4539), 'wtforms.validators.optional', 'validators.optional', ([], {}), '()\n', (4537, 4539), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((4549, 4587), 'wtforms.validators.URL', 'validators.URL', ([], {'message': '"""Invalid URL."""'}), "(message='Invalid URL.')\n", (4563, 4587), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((4718, 4775), 'wtforms.validators.Required', 'validators.Required', ([], {'message': '"""You must enter a password."""'}), "(message='You must enter a password.')\n", (4737, 4775), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((4787, 4862), 'wtforms.validators.Length', 'validators.Length', ([], {'min': '(8)', 'message': '"""Password must be at least 8 characters."""'}), "(min=8, message='Password must be at least 8 characters.')\n", (4804, 4862), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((5094, 5179), 'wtforms.validators.Required', 'validators.Required', ([], {'message': '"""Please read and agree to the MLH Code of Conduct."""'}), "(message='Please read and agree to the MLH Code of Conduct.'\n    )\n", (5113, 5179), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((5317, 5407), 'wtforms.validators.Required', 'validators.Required', ([], {'message': '"""Please read and agree to the MLH Terms and Conditions."""'}), "(message=\n    'Please read and agree to the MLH Terms and Conditions.')\n", (5336, 5407), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((5692, 5732), 'wtforms.ValidationError', 'ValidationError', (['"""Passwords must match."""'], {}), "('Passwords must match.')\n", (5707, 5732), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((6636, 6673), 'wtforms.ValidationError', 'ValidationError', (['"""Enter your gender."""'], {}), "('Enter your gender.')\n", (6651, 6673), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((6752, 6798), 'wtforms.validators.Required', 'validators.Required', ([], {'message': '"""Enter an email."""'}), "(message='Enter an email.')\n", (6771, 6798), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((6810, 6860), 'wtforms.validators.Email', 'validators.Email', ([], {'message': '"""Invalid email address."""'}), "(message='Invalid email address.')\n", (6826, 6860), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((6974, 7033), 'wtforms.validators.Required', 'validators.Required', ([], {'message': '"""You must enter a first name."""'}), "(message='You must enter a first name.')\n", (6993, 7033), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((7154, 7212), 'wtforms.validators.Required', 'validators.Required', ([], {'message': '"""You must enter a last name."""'}), "(message='You must enter a last name.')\n", (7173, 7212), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((7335, 7400), 'wtforms.validators.Required', 'validators.Required', ([], {'message': '"""Enter your company/schools\'s name."""'}), '(message="Enter your company/schools\'s name.")\n', (7354, 7400), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((7525, 7592), 'wtforms.validators.Required', 'validators.Required', ([], {'message': '"""Enter your preferred contact number."""'}), "(message='Enter your preferred contact number.')\n", (7544, 7592), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((7604, 7680), 'wtforms.validators.Regexp', 'validators.Regexp', (['phone_regex'], {'message': '"""Please enter a valid phone number."""'}), "(phone_regex, message='Please enter a valid phone number.')\n", (7621, 7680), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((7829, 7886), 'wtforms.validators.Required', 'validators.Required', ([], {'message': '"""You must select an option."""'}), "(message='You must select an option.')\n", (7848, 7886), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((8103, 8195), 'wtforms.validators.Length', 'validators.Length', ([], {'max': '(1500)', 'message': '"""Response must be less than 1500 characters long."""'}), "(max=1500, message=\n    'Response must be less than 1500 characters long.')\n", (8120, 8195), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((8356, 8448), 'wtforms.validators.Length', 'validators.Length', ([], {'max': '(1500)', 'message': '"""Response must be less than 1500 characters long."""'}), "(max=1500, message=\n    'Response must be less than 1500 characters long.')\n", (8373, 8448), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((8584, 8605), 'wtforms.validators.optional', 'validators.optional', ([], {}), '()\n', (8603, 8605), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((8615, 8653), 'wtforms.validators.URL', 'validators.URL', ([], {'message': '"""Invalid URL."""'}), "(message='Invalid URL.')\n", (8629, 8653), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((8785, 8806), 'wtforms.validators.optional', 'validators.optional', ([], {}), '()\n', (8804, 8806), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((8816, 8854), 'wtforms.validators.URL', 'validators.URL', ([], {'message': '"""Invalid URL."""'}), "(message='Invalid URL.')\n", (8830, 8854), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((8989, 9010), 'wtforms.validators.optional', 'validators.optional', ([], {}), '()\n', (9008, 9010), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((9020, 9058), 'wtforms.validators.URL', 'validators.URL', ([], {'message': '"""Invalid URL."""'}), "(message='Invalid URL.')\n", (9034, 9058), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((9191, 9212), 'wtforms.validators.optional', 'validators.optional', ([], {}), '()\n', (9210, 9212), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((9222, 9260), 'wtforms.validators.URL', 'validators.URL', ([], {'message': '"""Invalid URL."""'}), "(message='Invalid URL.')\n", (9236, 9260), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((9391, 9448), 'wtforms.validators.Required', 'validators.Required', ([], {'message': '"""You must enter a password."""'}), "(message='You must enter a password.')\n", (9410, 9448), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((9460, 9535), 'wtforms.validators.Length', 'validators.Length', ([], {'min': '(8)', 'message': '"""Password must be at least 8 characters."""'}), "(min=8, message='Password must be at least 8 characters.')\n", (9477, 9535), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((9767, 9852), 'wtforms.validators.Required', 'validators.Required', ([], {'message': '"""Please read and agree to the MLH Code of Conduct."""'}), "(message='Please read and agree to the MLH Code of Conduct.'\n    )\n", (9786, 9852), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((9990, 10080), 'wtforms.validators.Required', 'validators.Required', ([], {'message': '"""Please read and agree to the MLH Terms and Conditions."""'}), "(message=\n    'Please read and agree to the MLH Terms and Conditions.')\n", (10009, 10080), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((11048, 11094), 'wtforms.validators.Required', 'validators.Required', ([], {'message': '"""Enter an email."""'}), "(message='Enter an email.')\n", (11067, 11094), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((11106, 11156), 'wtforms.validators.Email', 'validators.Email', ([], {'message': '"""Invalid email address."""'}), "(message='Invalid email address.')\n", (11122, 11156), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((11382, 11428), 'wtforms.validators.Required', 'validators.Required', ([], {'message': '"""Enter an email."""'}), "(message='Enter an email.')\n", (11401, 11428), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((11440, 11490), 'wtforms.validators.Email', 'validators.Email', ([], {'message': '"""Invalid email address."""'}), "(message='Invalid email address.')\n", (11456, 11490), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((11631, 11688), 'wtforms.validators.Required', 'validators.Required', ([], {'message': '"""You must enter a password."""'}), "(message='You must enter a password.')\n", (11650, 11688), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((11700, 11775), 'wtforms.validators.Length', 'validators.Length', ([], {'min': '(8)', 'message': '"""Password must be at least 8 characters."""'}), "(min=8, message='Password must be at least 8 characters.')\n", (11717, 11775), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((12128, 12168), 'wtforms.ValidationError', 'ValidationError', (['"""Passwords must match."""'], {}), "('Passwords must match.')\n", (12143, 12168), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((12249, 12308), 'wtforms.validators.Required', 'validators.Required', ([], {'message': '"""You must enter a first name."""'}), "(message='You must enter a first name.')\n", (12268, 12308), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((12424, 12482), 'wtforms.validators.Required', 'validators.Required', ([], {'message': '"""You must enter a last name."""'}), "(message='You must enter a last name.')\n", (12443, 12482), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((12632, 12700), 'wtforms.validators.Required', 'validators.Required', ([], {'message': '"""You must enter your current password."""'}), "(message='You must enter your current password.')\n", (12651, 12700), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((12712, 12787), 'wtforms.validators.Length', 'validators.Length', ([], {'min': '(8)', 'message': '"""Password must be at least 8 characters."""'}), "(min=8, message='Password must be at least 8 characters.')\n", (12729, 12787), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((12922, 12984), 'wtforms.validators.Required', 'validators.Required', ([], {'message': '"""You must choose a new password."""'}), "(message='You must choose a new password.')\n", (12941, 12984), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((12996, 13071), 'wtforms.validators.Length', 'validators.Length', ([], {'min': '(8)', 'message': '"""Password must be at least 8 characters."""'}), "(min=8, message='Password must be at least 8 characters.')\n", (13013, 13071), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((13440, 13480), 'wtforms.ValidationError', 'ValidationError', (['"""Passwords must match."""'], {}), "('Passwords must match.')\n", (13455, 13480), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((14112, 14133), 'wtforms.validators.optional', 'validators.optional', ([], {}), '()\n', (14131, 14133), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((14289, 14342), 'wtforms.validators.Required', 'validators.Required', ([], {'message': '"""You must enter a name."""'}), "(message='You must enter a name.')\n", (14308, 14342), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((14481, 14546), 'wtforms.validators.Required', 'validators.Required', ([], {'message': '"""Enter your guardian\'s home number."""'}), '(message="Enter your guardian\'s home number.")\n', (14500, 14546), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((14558, 14634), 'wtforms.validators.Regexp', 'validators.Regexp', (['phone_regex'], {'message': '"""Please enter a valid phone number."""'}), "(phone_regex, message='Please enter a valid phone number.')\n", (14575, 14634), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((14778, 14848), 'wtforms.validators.Required', 'validators.Required', ([], {'message': '"""Enter your guardian\'s cellphone number."""'}), '(message="Enter your guardian\'s cellphone number.")\n', (14797, 14848), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((14860, 14936), 'wtforms.validators.Regexp', 'validators.Regexp', (['phone_regex'], {'message': '"""Please enter a valid phone number."""'}), "(phone_regex, message='Please enter a valid phone number.')\n", (14877, 14936), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((15071, 15117), 'wtforms.validators.Required', 'validators.Required', ([], {'message': '"""Enter an email."""'}), "(message='Enter an email.')\n", (15090, 15117), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((15129, 15179), 'wtforms.validators.Email', 'validators.Email', ([], {'message': '"""Invalid email address."""'}), "(message='Invalid email address.')\n", (15145, 15179), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((15323, 15376), 'wtforms.validators.Required', 'validators.Required', ([], {'message': '"""You must enter a name."""'}), "(message='You must enter a name.')\n", (15342, 15376), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((15534, 15608), 'wtforms.validators.Required', 'validators.Required', ([], {'message': '"""Enter your emergency contact\'s home number."""'}), '(message="Enter your emergency contact\'s home number.")\n', (15553, 15608), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((15620, 15696), 'wtforms.validators.Regexp', 'validators.Regexp', (['phone_regex'], {'message': '"""Please enter a valid phone number."""'}), "(phone_regex, message='Please enter a valid phone number.')\n", (15637, 15696), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((15859, 15931), 'wtforms.validators.Required', 'validators.Required', ([], {'message': '"""Enter your emergency contact\'s cellphone."""'}), '(message="Enter your emergency contact\'s cellphone.")\n', (15878, 15931), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((15943, 16019), 'wtforms.validators.Regexp', 'validators.Regexp', (['phone_regex'], {'message': '"""Please enter a valid phone number."""'}), "(phone_regex, message='Please enter a valid phone number.')\n", (15960, 16019), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((16173, 16219), 'wtforms.validators.Required', 'validators.Required', ([], {'message': '"""Enter an email."""'}), "(message='Enter an email.')\n", (16192, 16219), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((16231, 16281), 'wtforms.validators.Email', 'validators.Email', ([], {'message': '"""Invalid email address."""'}), "(message='Invalid email address.')\n", (16247, 16281), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((16422, 16479), 'wtforms.validators.Required', 'validators.Required', ([], {'message': '"""Enter your school address."""'}), "(message='Enter your school address.')\n", (16441, 16479), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((16606, 16660), 'wtforms.validators.Required', 'validators.Required', ([], {'message': '"""Enter your school town."""'}), "(message='Enter your school town.')\n", (16625, 16660), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((16786, 16841), 'wtforms.validators.Required', 'validators.Required', ([], {'message': '"""Enter your school state."""'}), "(message='Enter your school state.')\n", (16805, 16841), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((16978, 17036), 'wtforms.validators.Required', 'validators.Required', ([], {'message': '"""Enter school\'s home number."""'}), '(message="Enter school\'s home number.")\n', (16997, 17036), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((17048, 17124), 'wtforms.validators.Regexp', 'validators.Regexp', (['phone_regex'], {'message': '"""Please enter a valid phone number."""'}), "(phone_regex, message='Please enter a valid phone number.')\n", (17065, 17124), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((17267, 17320), 'wtforms.validators.Required', 'validators.Required', ([], {'message': '"""You must enter a name."""'}), "(message='You must enter a name.')\n", (17286, 17320), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((17461, 17507), 'wtforms.validators.Required', 'validators.Required', ([], {'message': '"""Enter an email."""'}), "(message='Enter an email.')\n", (17480, 17507), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((17519, 17569), 'wtforms.validators.Email', 'validators.Email', ([], {'message': '"""Invalid email address."""'}), "(message='Invalid email address.')\n", (17535, 17569), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((17703, 17724), 'wtforms.validators.optional', 'validators.optional', ([], {}), '()\n', (17722, 17724), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((17875, 17896), 'wtforms.validators.optional', 'validators.optional', ([], {}), '()\n', (17894, 17896), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((17906, 17956), 'wtforms.validators.Email', 'validators.Email', ([], {'message': '"""Invalid email address."""'}), "(message='Invalid email address.')\n", (17922, 17956), False, 'from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField\n'), ((6071, 6104), 're.match', 're.match', (['"""^(http|https)://"""', 'val'], {}), "('^(http|https)://', val)\n", (6079, 6104), False, 'import re\n'), ((10544, 10577), 're.match', 're.match', (['"""^(http|https)://"""', 'val'], {}), "('^(http|https)://', val)\n", (10552, 10577), False, 'import re\n')]