Feat: [#101] 비밀번호 재설정 기능 구현 완료

This commit is contained in:
sm4640
2026-01-09 17:18:14 +09:00
parent 41c1aa7013
commit a4fa5d152b
5 changed files with 103 additions and 6 deletions

View File

@@ -22,6 +22,10 @@ from users.models import User
from projects.models import Project, ProjectTeamList
from datetime import timedelta
from rest_framework_simplejwt.tokens import AccessToken
# from .schemas import send_sms_post_schema # Swagger나 drf-spectacular 등에 사용되는 데코레이터
INVITE_CHOICE_USE_TYPE ={
@@ -29,6 +33,8 @@ INVITE_CHOICE_USE_TYPE ={
'h': InviteCodeUseType.HACKATHON
}
PASSWORD_RESET_TOKEN_TTL_MINUTES = 5
class CertificateService:
@staticmethod
def send(code, identifier):
@@ -131,3 +137,15 @@ class ProjectInviteService(InviteService):
return ProjectTeamList.objects.create(user=invitee, project=work)
class PasswordResetTokenService:
@staticmethod
def issue_temp_access_token(*, user_id: str, identifier: str, use_type: str) -> str:
token = AccessToken()
token.set_exp(lifetime=timedelta(minutes=PASSWORD_RESET_TOKEN_TTL_MINUTES))
token["purpose"] = "password_reset"
token["user_id"] = str(user_id)
token["identifier"] = identifier
token["use_type"] = use_type
return str(token)