built routes for creation of char
This commit is contained in:
37
app/utils/session_user.py
Normal file
37
app/utils/session_user.py
Normal file
@@ -0,0 +1,37 @@
|
||||
from dataclasses import dataclass
|
||||
from typing import Optional, cast
|
||||
|
||||
|
||||
@dataclass
|
||||
class SessionUser:
|
||||
id: str = ""
|
||||
registered_on: str = ""
|
||||
name: str = ""
|
||||
email: str = ""
|
||||
email_verified: bool = False
|
||||
phone: str = ""
|
||||
phone_verified: bool = False
|
||||
mfa: bool = False
|
||||
|
||||
|
||||
@property
|
||||
def is_authenticated(self) -> bool:
|
||||
return True
|
||||
|
||||
@property
|
||||
def email_verification(self) -> bool:
|
||||
return self.email_verified
|
||||
|
||||
@property
|
||||
def phone_verification(self) -> bool:
|
||||
return self.phone_verification
|
||||
|
||||
def import_g_session(g_session:dict) -> SessionUser:
|
||||
u = SessionUser(
|
||||
id=g_session.get("$id"),
|
||||
name=g_session.get("name"),
|
||||
registered_on=g_session.get("registration"),
|
||||
email=g_session.get("email"),
|
||||
email_verified=g_session.get("emailVerification")
|
||||
)
|
||||
return u
|
||||
Reference in New Issue
Block a user