dynamicweb/utils/backend.py

14 lines
363 B
Python
Raw Normal View History

2019-12-10 17:53:50 +00:00
import logging
from django.contrib.auth.backends import ModelBackend
2019-12-10 17:53:50 +00:00
logger = logging.getLogger(__name__)
class MyLDAPBackend(ModelBackend):
def authenticate(self, username=None, password=None, **kwargs):
user = super().authenticate(username, password, **kwargs)
if user:
user.create_ldap_account(password)
return user