2019-12-10 17:53:50 +00:00
|
|
|
|
|
|
|
import logging
|
|
|
|
|
2019-12-19 09:03:25 +00:00
|
|
|
from django.contrib.auth.backends import ModelBackend
|
2019-12-10 17:53:50 +00:00
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
2019-12-13 15:37:30 +00:00
|
|
|
|
2019-12-19 09:03:25 +00:00
|
|
|
class MyLDAPBackend(ModelBackend):
|
|
|
|
def authenticate(self, username=None, password=None, **kwargs):
|
|
|
|
user = super().authenticate(username, password, **kwargs)
|
|
|
|
if user:
|
2019-12-14 09:29:45 +00:00
|
|
|
user.create_ldap_account(password)
|
2019-12-19 09:03:25 +00:00
|
|
|
return user
|