
    gU                     Z    d dl Z d dlZd dlmZ  ej        e          Zd Zd Zd Z	d Z
dS )    N)PermissionDeniedc                 "   | |k    rdddS t          |           dk     rdddS t          j        d|           sdddS t          j        d|           sdd	dS t          j        d
|           sdddS t          j        d|           sdddS dddS )NFzPassword does not match.statusmessage   zPassword length less than 8.z[a-z]z Lowercase missing from password!z[A-Z]z Uppercase missing from password!z[0-9]zDigit missing from password!z[@#_]z8Special character '@' , '#' , '_' missing from password!TzCorrect password format.)lenresearch)passwordconfirm_passwords     :D:\Project\DJANGO\BRDWT Project\brdwt\utils\validations.pyvalidate_passwordr   
   s    ###,FGGG
8}}q,JKKK9Wh'' P,NOOO9Wh'' P,NOOO9Wh'' L,JKKK9Wh'' h,fggg'ABBB    c                 >    | j                             d          dk    S )NHTTP_X_REQUESTED_WITHXMLHttpRequest)METAget)requests    r   is_ajaxr       s    <3448HHHr   c                 P    dt          |           cxk    rdk    rn ndddS dddS )Nr      TSuccessr   Fz+Username should be between 8-20 characters.)r	   )usernames    r   validate_usernamer   $   sG    CMMR9555(UVVVr   c                       fd}|S )Nc                     |j         j        | j        vr+d}t                              |           t	          |           | |          S )Nz"The users does not have permission)user	user_typeloggerinfor   )selfr   msgfunctions      r   wrapperzvalidate_role.<locals>.wrapper+   sL    <!776CKK"3'''xg&&&r    )r%   r&   s   ` r   validate_roler(   *   s#    ' ' ' ' ' Nr   )r
   loggingdjango.core.exceptionsr   	getLogger__name__r!   r   r   r   r(   r'   r   r   <module>r-      s    				  3 3 3 3 3 3 
	8	$	$C C C,I I IW W W    r   