
    ~Oi                     F   d dl mZmZmZ d dlmZ d dlmZ d dlm	Z	 d dl
Z
d dlmZmZmZ  e            Z ee          Z e
j        e
j        d            e
j        e          Z ed	d
g          Z ed          Z e	eddge          dededefd            ZdS )    )	APIRouterRequestHTTPException)HTMLResponse)Jinja2Templates)add_dual_routeN)get_pingconf_vars
open_mysqlget_mysql_credsz)%(asctime)s - %(levelname)s - %(message)s)levelformatz/confirmconfirm)prefixtags	templates)	directory GET)methodsresponse_classrequestidcodec           
         t                               d| d|            	 t          t                    5 }|                    d          5 }d}|                    ||f           |                                }t                               d|            |st          dd	          |d
         dk    rBt          	                    d| dd|d          ddd          cd d d            cd d d            S |d         |k    rt          dd	          d}|                    ||f           |
                                 t                               d| d           t          	                    d| dd|d          ddd          cd d d            cd d d            S # 1 swxY w Y   	 d d d            d S # 1 swxY w Y   d S # t          $ r3}t                               d|            t          dd	          d }~ww xY w)NzReceived confirm request: id=z, code=T)
dictionaryzNSELECT StatusCode, ConfirmCode, Handle, Email FROM Handles WHERE HandleID = %szLookup result: i  zInvalid confirmation link)status_codedetail
StatusCodeUzconfirm.htmlzEmail Already ConfirmedzHello <strong>HandlezK</strong>, your account is already confirmed.<br>You may now sign in below.)r   message_titlemessage_bodysignin_linkConfirmCodei  zInvalid confirmation codez
                    UPDATE Handles
                    SET StatusCode = 'F', ConfirmCode = NULL
                    WHERE HandleID = %s
                zAccount z confirmed successfully.zConfirmation SuccesszThank you <strong>zS</strong>! Your account has been successfully confirmed. You may now sign in below.zError during confirmation: i  z)Internal server error during confirmation)loggerdebugr
   mysql_credscursorexecutefetchoner   r   TemplateResponsecommit	Exception	exception)	r   r   r   connr(   sqlresult
update_sqles	            */wd/v2025.freedom4um.com/routes/confirm.pyr   r      sB   
LLBBBDBBCCC:a$$ 5	-- 4fsRE*****7v77888 ]'C@[\\\\ ,'3..$55&'.-F!=1A != != != ,0  4 4 4 4 4 4 45	 5	 5	 5	 5	 5	 5	 5	6 -(D00'C@[\\\\

 zB5111DDDDEEE !11"#*)?91A 9 9 9 (,	 	 Q4 4 4 4 4 4 45	 5	 5	 5	 5	 5	 5	 5	4 4 4 4 4 4 4 4 45	 5	 5	 5	 5	 5	 5	 5	 5	 5	 5	 5	 5	 5	 5	 5	 5	 5	n  a a a:q::;;;4_````asx   G	 F<BF# F<,G	 9BF#
F<G	 #F'	'F<*F'	+F</G	 <G  G	 G G	 	
H.HH)fastapir   r   r   fastapi.responsesr   fastapi.templatingr   utils.routesr   loggingutils.pingdatar	   r
   r   PingConfr'   basicConfigDEBUG	getLogger__name__r%   routerr   intstrr        r4   <module>rE      sQ   5 5 5 5 5 5 5 5 5 5 * * * * * * . . . . . . ' ' ' ' ' '  I I I I I I I I I I oh''  '-0[ \ \ \ \		8	$	$	*I;	7	7	7Ok222	UGLIII=aW =a# =aS =a =a =a JI=a =a =arD   