Реализовать ЛР 7 на оценку 4
Skeleton contracts / contracts (pull_request) Blocked by required conditions
Skeleton contracts / contracts (pull_request) Blocked by required conditions
This commit is contained in:
@@ -23,3 +23,10 @@ def password_matches(stored_hash: str, password: str) -> bool:
|
||||
return _hasher.verify(stored_hash, password)
|
||||
except (VerifyMismatchError, VerificationError):
|
||||
return False
|
||||
|
||||
|
||||
def verify_and_upgrade(stored_hash: str, password: str) -> tuple[bool, str | None]:
|
||||
if not password_matches(stored_hash, password):
|
||||
return False, None
|
||||
upgraded = hash_password(password) if _hasher.check_needs_rehash(stored_hash) else None
|
||||
return True, upgraded
|
||||
|
||||
Reference in New Issue
Block a user