+
    Äîiß  ã                  óì  € R t ^ RIHt ^ RIHtHtHtHt ^ RIH	t	 ^ RI
HtHtHtHtHt ^ RIHtHtHtHt ^ RIHtHtHtHt ^ RIHt ]! RR	.R
7      t ! R R]	4      t ! R R]	4      t]P?                  R4      R 4       t ]P?                  R4      R R l4       t!]P?                  R4      R R l4       t"]P?                  R]R7      R R l4       t#]PI                  R]R7      ]! ]4      3R R ll4       t%R# )uP  
routes/auth.py
POST /api/auth/captcha/challenge        â€” generate math CAPTCHA
POST /api/auth/captcha/refresh          â€” get a fresh challenge
POST /api/auth/captcha/verify           â€” verify answer
POST /api/auth/login                    â€” access key â†’ JWT
GET  /api/auth/me                       â€” current candidate info
)Úannotations)Ú	APIRouterÚDependsÚHTTPExceptionÚstatus)Ú	BaseModel)ÚLoginRequestÚLoginResponseÚCandidateOutÚCaptchaVerifyResponseÚSuccessResponse)Úvalidate_access_keyÚcreate_tokenÚget_redirect_urlÚget_stage_name)Úcreate_challengeÚrefresh_challengeÚverify_challengeÚvalidate_captcha_token)Úget_current_candidatez	/api/authÚauth)ÚprefixÚtagsc                  ó,   € ] tR t^t$ R]R&   R]R&   RtR# )ÚCaptchaVerifyRequestÚstrÚ
session_idÚanswer© N©Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__annotations__Ú__static_attributes__r   ó    Ú0D:\Python_Codes\gen_ai\people_hub\routes\auth.pyr   r      s   ‡ ØƒOØ‡Kr&   r   c                  ó"   € ] tR t^$t$ R]R&   RtR# )ÚCaptchaRefreshRequestr   r   r   Nr   r   r&   r'   r)   r)   $   s   ‡ Ø‡Or&   r)   z/captcha/challengec                 ó   € \        4       # )zDGenerate a fresh math CAPTCHA challenge. Always called on page load.)r   r   r&   r'   Úcaptcha_challenger+   *   s   € ô ÓÐr&   z/captcha/refreshc               ó   € V ^8„  d   QhRR/# )é   Úbodyr)   r   )Úformats   "r'   Ú__annotate__r0   1   s   € ÷ .ñ .Ð/ñ .r&   c                ó,   € \        V P                  4      # )z6Invalidate the current challenge and return a new one.)r   r   ©r.   s   &r'   Úcaptcha_refreshr3   0   s   € ô ˜TŸ_™_Ó-Ð-r&   z/captcha/verifyc               ó   € V ^8„  d   QhRR/# )r-   r.   r   r   )r/   s   "r'   r0   r0   7   s   € ÷ :ñ :Ð-ñ :r&   c                óB   € \        V P                  V P                  4      # )z#Verify the candidate's math answer.)r   r   r   r2   s   &r'   Úcaptcha_verifyr6   6   s   € ô ˜DŸO™O¨T¯[©[Ó9Ð9r&   z/login)Úresponse_modelc               ó   € V ^8„  d   QhRR/# )r-   r.   r   r   )r/   s   "r'   r0   r0   ?   s   € ÷ &ñ &�ñ &r&   c                ó–  € V P                   '       d7   \        V P                   4      '       g   \        \        P                  RR7      h\        V P                  4      pV'       g   \        \        P                  RR7      h\        VR,          VR,          VR,          4      pVR,          p\        VR\        VR,          VR,          VR,          VP                  R	R
4      VP                  R. 4      VP                  RR
4      VP                  R4      VP                  R4      VVR,          R7
      \        V4      \        V4      R7      # )uD   
Validate access key + captcha token â†’ return JWT + redirect URL.
z<CAPTCHA verification failed or expired. Please verify again.)Ústatus_codeÚdetailz7Invalid or expired access key. Please check your email.ÚidÚnameÚcurrent_stageÚbearerÚemailÚphoneÚ Ú	skill_setÚposition_appliedÚ
last_loginÚlast_question_attemptÚ
access_key)
r<   r=   r@   rA   rC   rD   rE   rF   r>   rG   )ÚtokenÚ
token_typeÚ	candidateÚredirect_urlÚ
stage_name)Úcaptcha_tokenr   r   r   ÚHTTP_400_BAD_REQUESTr   rG   ÚHTTP_401_UNAUTHORIZEDr   r	   r
   Úgetr   r   )r.   rJ   rH   Ústages   &   r'   ÚloginrR   >   s!  € ð
 ××ÐÜ% d×&8Ñ&8×9Ò9ÜÜ"×7Ñ7ØUôð ô
 $ D§O¡OÓ4€IßÜÜ×4Ñ4ØLô
ð 	
ô
 ˜ 4�¨)°FÕ*;¸YÀÕ=WÓX€EØ�oÕ&€EäØØÜØ˜�Ø˜6Õ"Ø˜GÕ$Ø—-‘- ¨Ó,Ø—m‘m K°Ó4Ø&Ÿ]™]Ð+=¸rÓBØ —}‘} \Ó2Ø"+§-¡-Ð0GÓ"HØØ  Õ.ô
ô & eÓ,Ü! %Ó(ô!ð r&   z/mec               ó   € V ^8„  d   QhRR/# )r-   rJ   Údictr   )r/   s   "r'   r0   r0   k   s   € ÷ +ñ +�$ñ +r&   c                ó   € \        V R7      # )z!Return current candidate profile.)Údata)r   )rJ   s   &r'   ÚmerW   j   s   € ô  	Ô*Ð*r&   N)&Ú__doc__Ú
__future__r   Úfastapir   r   r   r   Úpydanticr   Úmodels.schemasr   r	   r
   r   r   Úservices.auth_servicer   r   r   r   Úservices.captcha_servicer   r   r   r   Úmiddleware.auth_middlewarer   Úrouterr   r)   Úpostr+   r3   r6   rR   rP   rW   r   r&   r'   Ú<module>rb      s  ðñõ #ß =Ó =Ý ÷õ ÷ó ÷ó õ =á	˜+¨V¨HÔ	5€ô
˜9ô ô
˜Iô ð ‡�Ð!Ó"ñó #ðð
 ‡�ÐÓ ô.ó !ð.ð
 ‡�ÐÓô:ó  ð:ð ‡�ˆX m€Ó4ô&ó 5ð&ðV ‡�ˆE /€Ó2Ù Ð!6Ó7ö +ó 3ò+r&   