fix trab 2 / finalizado
This commit is contained in:
+3
-3
@@ -8,9 +8,9 @@ def register_user():
|
||||
user = input('Digite o usuário: ')
|
||||
seed_password = sha256(input('Digite a senha: ').encode('utf-8')).hexdigest()
|
||||
salt = ''.join(random.choice(string.ascii_letters) for i in range(16))
|
||||
salt = sha256(salt.encode('utf-8')).hexdigest()
|
||||
hashed_salt = sha256(salt.encode('utf-8')).hexdigest()
|
||||
|
||||
line = f'{user},{seed_password},{salt}\n'
|
||||
line = f'{user},{seed_password},{hashed_salt}\n'
|
||||
with open('server.dat', 'a', newline='') as setup:
|
||||
setup.write(line)
|
||||
|
||||
@@ -49,7 +49,7 @@ def validate_token():
|
||||
|
||||
valid, index = localtoken.validate_token(password, token)
|
||||
if valid:
|
||||
if used_index <= index and used_timestamp == localtoken.get_timestamp():
|
||||
if index >= used_index and used_timestamp == localtoken.get_timestamp():
|
||||
print('Chave inválida (invalidada)!')
|
||||
else:
|
||||
print('Chave válida!')
|
||||
|
||||
Reference in New Issue
Block a user