1
0
mirror of https://gitlab.com/akasroua/covot synced 2025-12-24 16:11:55 +01:00

Implement 2FA code verification

This commit is contained in:
2020-11-25 11:06:38 +01:00
parent 66ce3d6ff5
commit e6018bd753
2 changed files with 21 additions and 3 deletions

View File

@@ -25,3 +25,18 @@ def create_database(data):
if existing_row:
return
insert_data(data)
def save_attribute(attribute, data):
key = eval("Users." + attribute)
db.query(Users).filter(
or_(Users.correo_institucional == id, Users.numero_de_documento == id)
).update({key: data})
def verify_code(id, code):
db_record = search_database(id=id)
valid_code = code == db_record
if valid_code:
return True
return False