Ejemplo n.º 1
0
def AccountRecovery(mail):
    content = request.json
    msg = Message('Account Recovery',
                  sender=content['email'],
                  recipients=[content['email']])
    x = "".join([str(random.randint(1, 9)) for i in range(11)])
    print(x)
    msg.body = "Your code is {}".format(x)
    mail.send(msg)
    value = ["email", content['email']]
    verCode = ["verf_code", x]
    MySQLConnect.update("user", verCode, value)
    return 'sent'
Ejemplo n.º 2
0
def checkKey():
    content = request.json
    try:
        check = MySQLConnect.findVerf("user", content['code'])
    #except MySQLConnect.cursor.InternalError:
    except:
        check = ''  # length 0
    if len(check) == 0:
        result = {"ok": "false", "id": -1}
    else:
        result = {"ok": "true", "id": check[0][0]}
        value = ["user_id", check[0][0]]
        verCode = ["verf_code", "-1"]
        MySQLConnect.update("user", verCode, value)
    return jsonify(result)
    return "true"
Ejemplo n.º 3
0
def update():
    content = request.json
    print("update Route Call")
    results = MySQLConnect.update(content['table'], content['update'], content['where']);
    return 'updated'