forked from mtusi2026/mtusi2026lab7
feat: completed tasks for grade 4
This commit is contained in:
@@ -45,6 +45,11 @@ async def create_session(
|
||||
if not await security.verify_password(password, user.password_hash):
|
||||
raise unauthorized_basic()
|
||||
|
||||
if security.password_needs_rehash(user.password_hash):
|
||||
replacement = await security.hash_password(password)
|
||||
await users_storage.replace_password_hash(session, user.id, user.password_hash, replacement)
|
||||
await session.commit()
|
||||
|
||||
token = security.generate_token()
|
||||
expires_at = datetime.now(UTC) + timedelta(seconds=ttl_seconds)
|
||||
await sessions_storage.create_session(
|
||||
|
||||
Reference in New Issue
Block a user