HR-ATS-Portal/backend/forget_password/serializers.py

28 lines
774 B
Python

from forget_password.plugins import RESET_CODE_RESEND_SECONDS,RESET_CODE_TTL_SECONDS
from users.plugins import RESET_TOKEN_EXPIRE_SECONDS
def serialize_reset_request(email: str,expires_at) -> dict:
return {
"email": email,
"expires_at": expires_at.isoformat() if expires_at else None,
"expires_in": RESET_CODE_TTL_SECONDS,
"resend_after": RESET_CODE_RESEND_SECONDS,
}
def serialize_reset_token(reset_token: str,email: str) -> dict:
return {
"reset_token": reset_token,
"token_type": "bearer",
"expires_in": RESET_TOKEN_EXPIRE_SECONDS,
"data": {"email": email},
}
def serialize_reset_result(email: str) -> dict:
return {
"email": email,
"password_updated": True,
}