Authentication Backends¶
django-authtools provides two authentication backend classes. These backends offer more customization for authentication.
-
class
authtools.backends.
CaseInsensitiveUsernameFieldModelBackend
¶ Enables case-insensitive logins for the User model. It works by simply lowercasing usernames before trying to authenticate.
There is also a
CaseInsensitiveUsernameFieldBackendMixin
if you need more flexibility.To use this backend class, add it to your settings:
# settings.py AUTHENTICATION_BACKENDS = [ 'authtools.backends.CaseInsensitiveUsernameFieldModelBackend', ]
Warning
Use of this mixin assumes that all usernames are stored in their lowercase form, and that there is no way to have usernames differing only in case. If usernames can differ in case, this authentication backend mixin could cause errors in user authentication. It is advised that you use this mixin in conjuction with the
CaseInsensitiveUsernameFieldCreationForm
form.
-
class
authtools.backends.
CaseInsensitiveUsernameFieldBackendMixin
¶ Mixin enabling case-insensitive logins.