Exemple #1
0
def add_email():
    data = {'email': request.form['email']}
    if not Email.validate_email(request.form):
        return redirect('/')
    else:
        Email.add(data)
        emails = Email.all_emails()
        return render_template('success.html', emails=emails)
Exemple #2
0
def submitEmail():
    if not Email.validate_email(request.form):
        return redirect('/')

    data = {
        'email_address': (request.form['email_address']),
    }
    Email.saveToDB(data)
    flash('Thanks for entering a valid email address!')
    return redirect('/emailsMade')
Exemple #3
0
def verify_email():

    data = {'email': request.form['email']}

    valid = Email.validate_email(data)

    if valid:
        Email.process_email(data)

    return redirect('/')
Exemple #4
0
def create():
    if not EMAIL_REGEX.match(request.form['email']):
        flash("INVALID EMAIL ADDRESS")
        return redirect('/')
    for e in Email.show_all():
        if request.form['email'] == e['email']:
            flash("EMAIL ADDRESS ALREADY IN USE")
            return redirect('/')

    email = Email.submit(request.form)
    return redirect(f'/success/{email}')
Exemple #5
0
def add_email():
    if not EMAIL_REGEX.match(request.form['email']):
        flash("Invalid Email Address")
        return redirect('/')

    data = {"email": request.form['email']}
    if not Email.is_unique(data):
        flash("Email address already in use.")
        return redirect('/')

    Email.add_email(data)
    flash(f"The email you created {data['email']} is valid!")
    return redirect('/success')
Exemple #6
0
def submit():

    if not Email.validate_email(request.form):
        return redirect("/")

    mysql = connectToMySQL("email_val")
    query = "INSERT INTO emails (email, created_at, updated_at) VALUES (%(email)s, NOW(), NOW())"
    data = {
        "email" : request.form["email"]
    }
    mysql.query_db(query, data)
    return redirect ("/success")
Exemple #7
0
def delete(id):
    data = {"id": id}
    Email.delete(data)
    return redirect('/success')
Exemple #8
0
def success():
    emails = Email.get_all()
    return render_template('success.html', emails=emails)
Exemple #9
0
def delete(emailid):
    data = {'emailid': emailid}
    Email.delete(data)
    return redirect('/')
Exemple #10
0
def success(emailid):
    data = {'emailid': emailid}
    return render_template("success.html",
                           email=Email.show(data),
                           emails=Email.show_all())
Exemple #11
0
def delete(id):
    data = {
        'id': id,
    }
    Email.delete(data)
    return redirect("/success")
Exemple #12
0
def create():
    if not Email.validate_email(request.form):
        return redirect('/')
    data = {'email': request.form['email']}
    Email.create(data)
    return redirect('/success')
Exemple #13
0
def show():
    return render_template('success.html', emails=Email.get_all())
Exemple #14
0
def showEmails():

    return render_template('indexEmailsMade.html',
                           allEmails=Email.showEmailsInDB())
Exemple #15
0
def index():
    return render_template('show_all_emails.html', all_emails = Email.get_all())
Exemple #16
0
def add_email_to_db():
    if not Email.validate_email(request.form):
        return redirect('/enter_email')
    new_user_id = Email.insert_new_email(request.form)
    return redirect("/show_all_emails")