HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/django/contrib/auth/__pycache__/__init__.cpython-310.pyc
o

3�a��@sddlZddlZddlmZddlmZddlmZm	Z	ddl
mZddlm
Z
ddlmZddlmZd	d
lmZmZmZdZdZd
ZdZdd�Zd)dd�Zdd�Zed�dd��Zdd�Zed�d*dd��Zd*dd�Z dd �Z!d!d"�Z"d#d$�Z#d%d&�Z$d'd(�Z%dS)+�N)�apps)�settings)�ImproperlyConfigured�PermissionDenied)�rotate_token)�constant_time_compare��
import_string)�sensitive_variables�)�user_logged_in�user_logged_out�user_login_failed�
_auth_user_id�_auth_user_backend�_auth_user_hash�nextcCs
t|��S�Nr)�path�r�>/usr/lib/python3/dist-packages/django/contrib/auth/__init__.py�load_backend�
rFcCs>g}tjD]}t|�}|�|r||fn|�q|std��|S)Nz\No authentication backends have been defined. Does AUTHENTICATION_BACKENDS contain anything?)r�AUTHENTICATION_BACKENDSr�appendr)�
return_tuples�backends�backend_path�backendrrr�
_get_backendss
�rcCs
tdd�S)NF�r)rrrrr�get_backends%rr!�credentialscCs2t�dtj�}d}|D]}|�|�r|||<q|S)z�
    Clean a dictionary of credentials of potentially sensitive info before
    sending to less secure functions.

    Not comprehensive - intended for user_login_failed signal
    z'api|token|key|secret|password|signaturez********************)�re�compile�I�search)r"�SENSITIVE_CREDENTIALS�CLEANSED_SUBSTITUTE�keyrrr�_clean_credentials)s
�r*cCst�jj�|jt�Sr)�get_user_model�_meta�pk�	to_python�session�SESSION_KEY)�requestrrr�_get_user_session_key9sr2c	Ks�tdd�D]@\}}t�|j�}z|j|fi|��Wn	ty#Yqwz|j|fi|��}Wn
ty9Yn
w|dur?q||_|Stj	t
t|�|d�dS)zC
    If the given credentials are valid, return a User object.
    Tr N)�senderr"r1)r�inspect�	signature�authenticate�bind�	TypeErrorrrr�send�__name__r*)r1r"rr�backend_signature�userrrrr6?s"��r6cCs$d}|dur	|j}t|d�r|��}t|jvr0t|�|jks*|r/t|j�t	d�|�s/|j�
�n|j��z|p:|j}Wnt
y[tdd�}t|�dkrU|d\}}ntd��Ynwt|t�sgtd	|��|jj�|�|jt<||jt<||jt	<t|d
�r�||_t|�tj|j||d�dS)z�
    Persist a user id and a backend in the request. This way a user doesn't
    have to reauthenticate on every request. Note that data set during
    the anonymous session is retained when the user logs in.
    �N�get_session_auth_hashTr rrz�You have multiple authentication backends configured and therefore must provide the `backend` argument or set the `backend` attribute on the user.z5backend must be a dotted import path string (got %r).r<�r3r1r<)r<�hasattrr>r0r/r2r-r�get�HASH_SESSION_KEY�flush�	cycle_keyr�AttributeErrorr�len�
ValueError�
isinstance�strr8r,�value_to_string�BACKEND_SESSION_KEYrrr9�	__class__)r1r<r�session_auth_hashr�_rrr�loginZsD

��
�

���



rOcCs^t|dd�}t|dd�sd}tj|j||d�|j��t|d�r-ddlm}|�|_	dSdS)z_
    Remove the authenticated user's ID from the request and flush their session
    data.
    r<N�is_authenticatedTr?r��
AnonymousUser)
�getattrr
r9rLr/rCr@�django.contrib.auth.modelsrRr<)r1r<rRrrr�logout�s

�rUcCsDz	tjtjdd�WStytd��ty!tdtj��w)z?
    Return the User model that is active in this project.
    F)�
require_readyz:AUTH_USER_MODEL must be of the form 'app_label.model_name'z@AUTH_USER_MODEL refers to model '%s' that has not been installed)�django_apps�	get_modelr�AUTH_USER_MODELrGr�LookupErrorrrrrr+�s��r+cCs�ddlm}d}zt|�}|jt}Wn	tyYn:w|tjvrVt|�}|�	|�}t
|d�rV|j�t�}|o>t
||���}|sV|rOt
|d�rOt
||���sV|j��d}|pZ|�S)z�
    Return the user model instance associated with the given request session.
    If no user is retrieved, return an instance of `AnonymousUser`.
    rrQNr>�_legacy_get_session_auth_hash)�modelsrRr2r/rK�KeyErrorrrr�get_userr@rArBrr>r[rC)r1rRr<�user_idrr�session_hash�session_hash_verifiedrrrr^�s6�


����

r^cCsd||jfS)zI
    Return the codename of the permission for the specified action.
    z%s_%s)�
model_name)�action�optsrrr�get_permission_codename�srecCs8|j��t|d�r|j|kr|��|jt<dSdSdS)aG
    Updating a user's password logs out all sessions for the user.

    Take the current request and the updated user object from which the new
    session hash will be derived and update the session hash appropriately to
    prevent a password change from logging out the session from which the
    password was changed.
    r>N)r/rDr@r<r>rB)r1r<rrr�update_session_auth_hash�s
	�rf)Fr)&r4r#�django.appsrrW�django.confr�django.core.exceptionsrr�django.middleware.csrfr�django.utils.cryptor�django.utils.module_loadingr	�django.views.decorators.debugr
�signalsrr
rr0rKrB�REDIRECT_FIELD_NAMErrr!r*r2r6rOrUr+r^rerfrrrr�<module>s8



0#