Exemplo n.º 1
0
def account():
    tkn = request.form["token"]
    if not session.get('userMail') is None:
        z = getClientData(encode(session['userMail'], 13))
        user_tkn = str(int(getTokenUser(encode(session['userMail'], 11))))
        print("user token = "+user_tkn)
        if tkn == user_tkn:
            ChangeTokenUser(encode(session['userMail'], 11))
            return render_template("MainPage.html", name=decode(z[0], 13), firstname=decode(z[1], 13), balance=z[2], Incomes=z[3], Expenses=z[4])
        else:
            return render_template("token.html", error='error :  wrong token!')
    else:
        return redirect('/signin')
Exemplo n.º 2
0
def token():
    f = open("message.html", "r")
    ms = f.read()
    f.close()
    mail = request.form["email"]
    z = getClientData(encode(request.form["email"], 13))
    ms = str.replace(ms, "name", decode(z[0], 13))
    print(ms)
    print("coded mail : "+mail)
    print("coded mail : "+encode(mail, 11))
    print("coded mail : "+encode(mail, 12))
    print("coded mail : "+encode(mail, 13))
    session['userMail'] = mail
    password = request.form["passw"]
    print("password entred is : " + password)
    print("password is : "+decode(str(getUserPassword(encode(mail, 12), init())), 12))
    if(password == decode(str(getUserPassword(encode(mail, 12), init())), 12)):
        sendMail(mail, "Bank Token", ms)
        return render_template("token.html", error='')
    return render_template("signin.html", wrongpassword='******')
Exemplo n.º 3
0
def register():
    email = request.form.get('email')
    name = request.form.get('name')
    password = request.form.get('passw')
    prénom = request.form.get('prénom')
    sexe=request.form.get('sexe')
    print(email)
    if(email is not None):
        if(getUserPassword(decode(email, 12), init()) == ''):
            if(validMail(email)):
            tk = setToken(email=encode(email, 11))

            ud = setUserData(email=encode(email, 12), login=encode(
                password, 12), passwords=init())

            cd = setClientData(email=encode(email, 13), nom=encode(name, 13), prénom=encode(prénom, 13),
                               sex=sexe, balance='0.0', incomes='0.0', expenses='0.0')
            return render_template("signin.html", wrongpassword="")
            else:
                return render_template("register.html", error="entrez un mail valide ! ")
        else:
            return render_template("register.html", error="votre mail existe deja")

    return render_template("register.html", error="")