This commit is contained in:
aitzol 2023-11-26 18:49:05 +01:00
parent 490e9bb80c
commit 407fa6351d
2 changed files with 5 additions and 2 deletions

3
app.py
View File

@ -39,7 +39,6 @@ from user_agents import parse as ua_parse
from datetime import datetime from datetime import datetime
import cryptocode import cryptocode
import base64 import base64
import uuid
BASE_DIR = path.dirname(__file__) BASE_DIR = path.dirname(__file__)
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -161,7 +160,7 @@ def post_user():
#if(check_2fa_step1(form('username'))): #if(check_2fa_step1(form('username'))):
if(newSession().get()['secureAuth']): if(newSession().get()['secureAuth']):
# encrypt and store the credentials # encrypt and store the credentials
key = uuid.uuid4().hex key = tools.key()
data = ';'.join([form('username'),form('password'),newSession().get()['authCode']]) data = ';'.join([form('username'),form('password'),newSession().get()['authCode']])
data_enc = cryptocode.encrypt(data, key) data_enc = cryptocode.encrypt(data, key)
data_to_url = base64.urlsafe_b64encode(str.encode(data_enc)) data_to_url = base64.urlsafe_b64encode(str.encode(data_enc))

View File

@ -6,6 +6,7 @@ from onetimepass import valid_totp
from secrets import choice from secrets import choice
import segno import segno
from os import path from os import path
import uuid
class Tools(): class Tools():
@ -69,4 +70,7 @@ class Tools():
print('Wrong otp, please try again.') print('Wrong otp, please try again.')
return False return False
def key(self):
return uuid.uuid4().hex
tools = Tools() tools = Tools()