예제 #1
0
def register():
    form = RegisterForm(request.form)
    flag = False
    fistname = None

    if len(form.errors):
        print(form.errors)
    if request.method == 'POST':
        fistname = form.fistname.data
        lastname = form.lastname.data
        mail = form.mail.data
        password = form.password.data
        confirmpass = form.confirmpass.data

        if fistname != '' and lastname != '' and mail != '' and password != '' and confirmpass != '':
            user = {
                "fistname": fistname,
                "lastname": lastname,
                "mail": mail,
                "password": password,
                "confirmpass": confirmpass
            }
            db_insert_user(users, user)
            flag = True

    msg = Message('Gracias por tu registro',
                  sender='*****@*****.**',
                  recipients=[form.mail.data])

    msg.html = render_template('email.html', fistname=fistname)
    #mail.send(msg)

    return render_template('register.html', flag=flag, fistname=fistname)
예제 #2
0
def login():
    form = BuyForm(request.form)
    login_error = False
    if request.method == 'POST':
        item = form.item.data
        precio = form.precio.data
        if item != '' and precio != '':
            user = {"item": item, "precio": precio}
            db_insert_user(users, user)
            registro = db_find_all(users)
            flag = True
            return render_template('index.html', users=registro)
    return render_template('index.html',
                           login_error=login_error,
                           users=registro)
예제 #3
0
def index():
    form = BuyForm(request.form)
    flag = False
    name = None

    if len(form.errors):
        print(form.errors)
    if request.method == 'POST':
        item = form.item.data
        precio = form.precio.data
        if item != '' and precio != '':
            print(f"Nombre capturado: {item}")
            print(f"Email capturado: {precio}")
            user = {"item": item, "precio": precio}
            db_insert_user(users, user)
            flag = True

    return render_template('index.html', flag=flag, name=name)
예제 #4
0
def index():
    form = EmailForm(request.form)
    flag = False
    name = None

    if len(form.errors):
        print(form.errors)
    if request.method == 'POST':
        email = form.email.data
        name = form.name.data
        if email != '' and name != '':
            print(f"Nombre capturado: {name}")
            print(f"Email capturado: {email}")
            user = {"name": name, "email": email}
            db_insert_user(users, user)
            flag = True

    return render_template('index.html', flag=flag, name=name)