better time usings
This commit is contained in:
@@ -11,7 +11,7 @@ Models:
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime
|
||||
from datetime import datetime, timezone
|
||||
from enum import Enum
|
||||
from typing import List, Optional
|
||||
|
||||
@@ -422,7 +422,7 @@ class UserSession(Base, TimestampMixin):
|
||||
@property
|
||||
def is_expired(self) -> bool:
|
||||
"""Check if session has expired."""
|
||||
return datetime.utcnow() > self.expires_at
|
||||
return datetime.now(timezone.utc) > self.expires_at
|
||||
|
||||
def revoke(self) -> None:
|
||||
"""Revoke this session."""
|
||||
|
||||
Reference in New Issue
Block a user