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)
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')
def verify_email(): data = {'email': request.form['email']} valid = Email.validate_email(data) if valid: Email.process_email(data) return redirect('/')
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}')
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')
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")
def delete(id): data = {"id": id} Email.delete(data) return redirect('/success')
def success(): emails = Email.get_all() return render_template('success.html', emails=emails)
def delete(emailid): data = {'emailid': emailid} Email.delete(data) return redirect('/')
def success(emailid): data = {'emailid': emailid} return render_template("success.html", email=Email.show(data), emails=Email.show_all())
def delete(id): data = { 'id': id, } Email.delete(data) return redirect("/success")
def create(): if not Email.validate_email(request.form): return redirect('/') data = {'email': request.form['email']} Email.create(data) return redirect('/success')
def show(): return render_template('success.html', emails=Email.get_all())
def showEmails(): return render_template('indexEmailsMade.html', allEmails=Email.showEmailsInDB())
def index(): return render_template('show_all_emails.html', all_emails = Email.get_all())
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")