This commit is contained in:
Aitzol 2023-11-22 20:45:37 +01:00
parent f2ffabad3e
commit 4fe1bec588
2 changed files with 5 additions and 1317 deletions

8
app.py
View File

@ -54,7 +54,6 @@ def get_index():
@get('/user') @get('/user')
def get_index(): def get_index():
print('SESSION:',newSession().get())
try: try:
print('SESSION:',newSession().get()) print('SESSION:',newSession().get())
return user_tpl(data=newSession().get(), str=i18n.str) return user_tpl(data=newSession().get(), str=i18n.str)
@ -162,8 +161,11 @@ def post_user():
LOG.warning("Unsuccessful attempt to login %s: %s" % (form('username'), e)) LOG.warning("Unsuccessful attempt to login %s: %s" % (form('username'), e))
return error(str(e)) return error(str(e))
#data=[form('username'),form('password'),newSession().get()['id'],newSession().get()['authCode']]
#print('N:',newSession().get()['id']) #print('N:',newSession().get()['id'])
key = cryptocode.encrypt(form('password'), newSession().get()['id']) key = cryptocode.encrypt(form('password'), newSession().get()['id'])
#key = cryptocode.encrypt(data, newSession().get()['id'])
print(key) print(key)
key = base64.urlsafe_b64encode(str.encode(key)) key = base64.urlsafe_b64encode(str.encode(key))
print(key) print(key)
@ -171,7 +173,7 @@ def post_user():
try: try:
if(check_2fa_step1(form('username'))): if(check_2fa_step1(form('username'))):
print('kk') print('kk')
logout(form('username')) #logout(form('username'))
return index_tpl(two_factor_authentication=True, key=key, str=i18n.str) return index_tpl(two_factor_authentication=True, key=key, str=i18n.str)
except Error as e: except Error as e:
LOG.warning("Erabiltzailea ez da aurkitu???") LOG.warning("Erabiltzailea ez da aurkitu???")
@ -216,7 +218,7 @@ def post_user_step2(key):
print("sid:",newSession().get()['id']) print("sid:",newSession().get()['id'])
print('pwd:',password) print('pwd:',password)
#logout(newSession().get()['username']) logout(newSession().get()['username'])
def error(msg): def error(msg):
return index_tpl(alerts=[('error', msg, 'fadeOut')], str=i18n.str) return index_tpl(alerts=[('error', msg, 'fadeOut')], str=i18n.str)

1314
ç

File diff suppressed because it is too large Load Diff