Backends

evileg_core.backends module

class evileg_core.backends.EEmailOrUsernameModelBackend[source]

Bases: django.contrib.auth.backends.ModelBackend

Authentication backend for using email or username for authentication on the site.

authenticate(request, username=None, password=None)[source]
Parameters
  • request – HTTP Request

  • username – username or email

  • password – password

Returns

User Object or None

get_user(user_id)[source]

Function for get authenticated user

Parameters

user_id – id of user in database

Returns

User Object or None

validate_email(email)[source]

Check if email is really email

Parameters

email – email

Returns

email or None

Examples

EEmailOrUsernameModelBackend

Added authentication backend to your settings.py

AUTHENTICATION_BACKENDS = (
    'evileg_core.backends.EEmailOrUsernameModelBackend',
    'django.contrib.auth.backends.ModelBackend',
)

And authenticate yourself using email instead of username