3
ž­öV<  ã               @   s:   d dl mZ G dd„ deƒZG dd„ deeƒZeZeZdS )é    )ÚModelBackendc                   s   e Zd Zd‡ fdd„	Z‡  ZS )Ú(CaseInsensitiveUsernameFieldBackendMixinNc                s,   |dk	r|j ƒ }tt| ƒjf ||dœ|—ŽS )a=  
        This authentication backend assumes that usernames are email addresses and simply
        lowercases a username before an attempt is made to authenticate said username using a
        superclass's authenticate method. This superclass should be either a user-defined
        authentication backend, or a Django-provided authentication backend (e.g., ModelBackend).

        Example usage:
            See CaseInsensitiveUsernameFieldBackend, below.

        NOTE:
            A word of caution. Use of this backend presupposes a way to ensure that users cannot
            create usernames that differ only in case (e.g., joe@test.org and JOE@test.org). It is
            advised that you use this backend in conjunction with the
            CaseInsensitiveUsernameFieldCreationForm provided in the forms module.
        N)ÚusernameÚpassword)ÚlowerÚsuperr   Úauthenticate)Úselfr   r   Úkwargs)Ú	__class__© úR/var/www/html/enquirykeeper_venv/lib/python3.6/site-packages/authtools/backends.pyr      s    z5CaseInsensitiveUsernameFieldBackendMixin.authenticate)NN)Ú__name__Ú
__module__Ú__qualname__r   Ú__classcell__r   r   )r   r   r      s   r   c               @   s   e Zd ZdS )Ú(CaseInsensitiveUsernameFieldModelBackendN)r   r   r   r   r   r   r   r      s   r   N)Zdjango.contrib.auth.backendsr   Úobjectr   r   Z CaseInsensitiveEmailBackendMixinZ CaseInsensitiveEmailModelBackendr   r   r   r   Ú<module>   s   