o
    ÕèFh2  ã                   @   sr   d dl mZ d dlmZ d dlmZ d dlmZmZm	Z	m
Z
 d dlmZ d dlmZ dZdd	„ Zd
efdd„ZdS )é    )ÚPath)Úsettings)ÚHttpResponseForbidden)ÚContextÚEngineÚTemplateDoesNotExistÚloader)Úgettext)Úget_docs_versionz403_csrf.htmlc                 C   s   t tƒjd |  S )z½
    Return a path to a builtin template.

    Avoid calling this function at the module level or in a class-definition
    because __file__ may not exist, e.g. in frozen environments.
    Ú	templates)r   Ú__file__Úparent)Úname© r   úJ/var/www/html/loop/nvenv/lib/python3.10/site-packages/django/views/csrf.pyÚbuiltin_template_path   s   r   Ú c                 C   sà   ddl m}m} tdƒtdƒ|||ktdƒtdƒtdƒ||ktdƒtd	ƒtjtƒ td
ƒdœ}zt |¡}W n3 t	yh   |t
kretdƒjdd��}tƒ  | ¡ ¡}W d  ƒ n1 s[w   Y  t|ƒ}n‚ Y nw t| |¡ƒS )z>
    Default view used when request fails CSRF protection
    r   )ÚREASON_NO_CSRF_COOKIEÚREASON_NO_REFERERÚ	Forbiddenz*CSRF verification failed. Request aborted.uø   You are seeing this message because this HTTPS site requires a â€œReferer headerâ€� to be sent by your web browser, but none was sent. This header is required for security reasons, to ensure that your browser is not being hijacked by third parties.u±   If you have configured your browser to disable â€œRefererâ€� headers, please re-enable them, at least for this site, or for HTTPS connections, or for â€œsame-originâ€� requests.u^  If you are using the <meta name="referrer" content="no-referrer"> tag or including the â€œReferrer-Policy: no-referrerâ€� header, please remove them. The CSRF protection requires the â€œRefererâ€� header to do strict referer checking. If youâ€™re concerned about privacy, use alternatives like <a rel="noreferrer" â€¦> for links to third-party sites.zÍYou are seeing this message because this site requires a CSRF cookie when submitting forms. This cookie is required for security reasons, to ensure that your browser is not being hijacked by third parties.u‰   If you have configured your browser to disable cookies, please re-enable them, at least for this site, or for â€œsame-originâ€� requests.z.More information is available with DEBUG=True.)ÚtitleÚmainÚreasonÚ
no_refererÚno_referer1Úno_referer2Úno_referer3Ú	no_cookieÚ
no_cookie1Ú
no_cookie2ÚDEBUGÚdocs_versionÚmorezcsrf_403.htmlzutf-8)ÚencodingN)Údjango.middleware.csrfr   r   Ú_r   r    r
   r   Úget_templater   ÚCSRF_FAILURE_TEMPLATE_NAMEr   Úopenr   Úfrom_stringÚreadr   r   Úrender)Úrequestr   Útemplate_namer   r   ÚcÚtÚfhr   r   r   Úcsrf_failure   sJ   ÿÿÿÿÿÚ(ÿ
ýû	r1   N)Úpathlibr   Údjango.confr   Údjango.httpr   Údjango.templater   r   r   r   Údjango.utils.translationr	   r%   Údjango.utils.versionr
   r'   r   r1   r   r   r   r   Ú<module>   s    
