https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/django/contrib/auth/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/django/contrib/auth/__pycache__/password_validation.cpython-310.pyc
o

3�a�"�@sddlZddlZddlZddlmZddlmZddlmZddl	m
Z
mZmZddl
mZddlmZmZddlmZdd	lmZmZejdd
�dd��Zd
d�Zd!dd�Zd!dd�Zd"dd�Zd"dd�Zeee�Z Gdd�d�Z!dd�Z"Gdd�d�Z#Gdd�d�Z$Gdd �d �Z%dS)#�N)�SequenceMatcher)�Path)�settings)�FieldDoesNotExist�ImproperlyConfigured�ValidationError)�lazy)�format_html�format_html_join)�
import_string)�gettext�ngettext)�maxsizecCs
ttj�S�N)�get_password_validatorsr�AUTH_PASSWORD_VALIDATORS�rr�I/usr/lib/python3/dist-packages/django/contrib/auth/password_validation.py�get_default_password_validatorss
rc
Csbg}|D]*}zt|d�}Wntyd}t||d��w|�|di|�di����q|S)N�NAMEzZThe module in NAME could not be imported: %s. Check your AUTH_PASSWORD_VALIDATORS setting.�OPTIONSr)r�ImportErrorr�append�get)�validator_config�
validators�	validator�klass�msgrrrrs�rcCsjg}|dur	t�}|D]!}z|�||�Wqty,}z|�|�WYd}~qd}~ww|r3t|��dS)z�
    Validate whether the password meets all validator requirements.

    If the password is valid, return ``None``.
    If the password is invalid, raise ValidationError with all error messages.
    N)r�validaterr)�password�user�password_validators�errorsr�errorrrr�validate_password#s���r%cCs6|durt�}|D]}t|ddd��}|||�q	dS)zy
    Inform all validators that have implemented a password_changed() method
    that the password has been changed.
    N�password_changedcWsdSrr)�arrr�<lambda>>sz"password_changed.<locals>.<lambda>)r�getattr)r r!r"rr&rrrr&6s�r&cCs.g}|dur	t�}|D]	}|�|���q|S)zG
    Return a list of all help texts of all configured validators.
    N)rr�
get_help_text)r"�
help_textsrrrr�password_validators_help_textsBsr,cCs0t|�}tdddd�|D��}|rtd|�SdS)z`
    Return an HTML string with all help texts of all configured validators
    in an <ul>.
    �z<li>{}</li>css�|]}|fVqdSrr)�.0�	help_textrrr�	<genexpr>Ts�z6_password_validators_help_text_html.<locals>.<genexpr>z<ul>{}</ul>)r,r
r	)r"r+�
help_itemsrrr�#_password_validators_help_text_htmlNsr2c@s,eZdZdZd
dd�Zddd�Zdd	�ZdS)�MinimumLengthValidatorz?
    Validate whether the password is of a minimum length.
    �cCs
||_dSr)�
min_length)�selfr5rrr�__init___s
zMinimumLengthValidator.__init__NcCs0t|�|jkrttdd|j�dd|jid��dS)NzNThis password is too short. It must contain at least %(min_length)d character.zOThis password is too short. It must contain at least %(min_length)d characters.�password_too_shortr5��code�params)�lenr5rr
�r6r r!rrrrbs���zMinimumLengthValidator.validatecCstdd|j�d|jiS)Nz=Your password must contain at least %(min_length)d character.z>Your password must contain at least %(min_length)d characters.r5)r
r5�r6rrrr*ns��z$MinimumLengthValidator.get_help_text)r4r)�__name__�
__module__�__qualname__�__doc__r7rr*rrrrr3[s


r3cCs0t|�}|d|}t|�}|d|ko||kS)a�
    Test that value is within a reasonable range of password.

    The following ratio calculations are based on testing SequenceMatcher like
    this:

    for i in range(0,6):
      print(10**i, SequenceMatcher(a='A', b='A'*(10**i)).quick_ratio())

    which yields:

    1 1.0
    10 0.18181818181818182
    100 0.019801980198019802
    1000 0.001998001998001998
    10000 0.00019998000199980003
    100000 1.999980000199998e-05

    This means a length_ratio of 10 should never yield a similarity higher than
    0.2, for 100 this is down to 0.02 and for 1000 it is 0.002. This can be
    calculated via 2 / length_ratio. As a result we avoid the potentially
    expensive sequence matching.
    ��
)r<)r �max_similarity�value�pwd_len�length_bound_similarity�	value_lenrrr�exceeds_maximum_length_ratiovsrJc@s4eZdZdZdZedfdd�Zddd�Zd	d
�ZdS)� UserAttributeSimilarityValidatora�
    Validate whether the password is sufficiently different from the user's
    attributes.

    If no specific attributes are provided, look at a sensible list of
    defaults. Attributes that don't exist are ignored. Comparison is made to
    not only the full attribute value, but also its components, so that, for
    example, a password is validated against either part of an email address,
    as well as the full address.
    )�username�
first_name�	last_name�emailgffffff�?cCs ||_|dkrtd��||_dS)Ng�������?z#max_similarity must be at least 0.1)�user_attributes�
ValueErrorrE)r6rPrErrrr7�s
z)UserAttributeSimilarityValidator.__init__Nc	
Cs�|sdS|��}|jD]W}t||d�}|rt|t�sq|��}t�d|�|g}|D]7}t||j|�r4q*t	||d��
�|jkrazt|j�|�j
�}WntyU|}Ynwttd�dd|id��q*qdS)Nz\W+)r'�bz4The password is too similar to the %(verbose_name)s.�password_too_similar�verbose_namer9)�lowerrPr)�
isinstance�str�re�splitrJrEr�quick_ratio�_meta�	get_fieldrTrr�_)	r6r r!�attribute_namerF�value_lower�value_parts�
value_partrTrrrr�s4
�����z)UserAttributeSimilarityValidator.validatecC�td�S)NuHYour password can’t be too similar to your other personal information.�r]r>rrrr*��z.UserAttributeSimilarityValidator.get_help_textr)r?r@rArB�DEFAULT_USER_ATTRIBUTESr7rr*rrrrrK�s

rKc@s@eZdZdZee���jdZefdd�Z	d
dd�Z
dd	�ZdS)�CommonPasswordValidatora�
    Validate whether the password is a common password.

    The password is rejected if it occurs in a provided list of passwords,
    which may be gzipped. The list Django ships with contains 20000 common
    passwords (lowercased and deduplicated), created by Royce Williams:
    https://gist.github.com/roycewilliams/281ce539915a947a23db17137d91aeb7
    The password list must be lowercased to match the comparison in validate().
    zcommon-passwords.txt.gzcCs�z%tj|ddd��}dd�|D�|_Wd�WdS1swYWdStyMt|��}dd�|D�|_Wd�YdS1sEwYYdSw)N�rtzutf-8)�encodingcS�h|]}|���qSr��strip�r.�xrrr�	<setcomp>��z3CommonPasswordValidator.__init__.<locals>.<setcomp>cSrirrjrlrrrrn�ro)�gzip�open�	passwords�OSError)r6�password_list_path�frrrr7�s&�
&��z CommonPasswordValidator.__init__NcCs&|����|jvrttd�dd��dS)NzThis password is too common.�password_too_common�r:)rUrkrrrr]r=rrrr�s��z CommonPasswordValidator.validatecCrb)Nu2Your password can’t be a commonly used password.rcr>rrrr*�rdz%CommonPasswordValidator.get_help_textr)r?r@rArBr�__file__�resolve�parent�DEFAULT_PASSWORD_LIST_PATHr7rr*rrrrrf�s	
rfc@s"eZdZdZddd�Zdd�ZdS)�NumericPasswordValidatorz8
    Validate whether the password is alphanumeric.
    NcCs|��rttd�dd��dS)Nz"This password is entirely numeric.�password_entirely_numericrw)�isdigitrr]r=rrrr�s��z!NumericPasswordValidator.validatecCrb)Nu*Your password can’t be entirely numeric.rcr>rrrr*�rdz&NumericPasswordValidator.get_help_textr)r?r@rArBrr*rrrrr|�s
r|)NNr)&�	functoolsrprX�difflibr�pathlibr�django.confr�django.core.exceptionsrrr�django.utils.functionalr�django.utils.htmlr	r
�django.utils.module_loadingr�django.utils.translationrr]r
�	lru_cacherrr%r&r,r2rW�"password_validators_help_text_htmlr3rJrKrfr|rrrr�<module>s0







0

https://t.me/RX1948 - 2025