Изменения подтверждения почты
This commit is contained in:
parent
7293399353
commit
ce73ad6684
1 changed files with 18 additions and 1 deletions
|
@ -132,7 +132,7 @@ async def resend_email_verification(user: SUser = Depends(get_current_user)):
|
||||||
|
|
||||||
|
|
||||||
@router.get(
|
@router.get(
|
||||||
"/email_verification/{user_code}",
|
"/email_verification/link/{user_code}",
|
||||||
status_code=status.HTTP_200_OK,
|
status_code=status.HTTP_200_OK,
|
||||||
response_model=SEmailVerification,
|
response_model=SEmailVerification,
|
||||||
)
|
)
|
||||||
|
@ -149,6 +149,23 @@ async def email_verification(user_code: str, uow=Depends(UnitOfWork)):
|
||||||
return {"email_verification": True}
|
return {"email_verification": True}
|
||||||
|
|
||||||
|
|
||||||
|
@router.get(
|
||||||
|
"/email_verification/code/{user_code}",
|
||||||
|
status_code=status.HTTP_200_OK,
|
||||||
|
response_model=SEmailVerification,
|
||||||
|
)
|
||||||
|
async def email_verification(user_code: str, user: SUser = Depends(get_current_user), uow=Depends(UnitOfWork)):
|
||||||
|
redis_session = get_redis_session()
|
||||||
|
async with uow:
|
||||||
|
verification_code = await RedisService.get_verification_code(redis=redis_session, user_id=user.id)
|
||||||
|
if verification_code != user_code:
|
||||||
|
raise WrongCodeException
|
||||||
|
|
||||||
|
await uow.user.change_data(user_id=user.id, role=settings.VERIFICATED_USER)
|
||||||
|
await uow.commit()
|
||||||
|
return {"email_verification": True}
|
||||||
|
|
||||||
|
|
||||||
@router.post(
|
@router.post(
|
||||||
"/login",
|
"/login",
|
||||||
status_code=status.HTTP_200_OK,
|
status_code=status.HTTP_200_OK,
|
||||||
|
|
Loading…
Add table
Reference in a new issue