mirror of
https://github.com/retspen/webvirtcloud
synced 2026-03-22 02:24:56 +00:00
Working
This commit is contained in:
parent
5ff7a73335
commit
306c4db3cd
2 changed files with 7 additions and 2 deletions
|
|
@ -35,7 +35,9 @@ class LdapAuthenticationBackend(ModelBackend):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def authenticate(self, request, username=None, password=None, **kwargs):
|
def authenticate(self, request, username=None, password=None, **kwargs):
|
||||||
print("authenticate")
|
if not settings.LDAP_ENABLED:
|
||||||
|
return None
|
||||||
|
print("authenticate_ldap")
|
||||||
# Get the user information from the LDAP if he can be authenticated
|
# Get the user information from the LDAP if he can be authenticated
|
||||||
isAdmin = False
|
isAdmin = False
|
||||||
isStaff = False
|
isStaff = False
|
||||||
|
|
@ -97,7 +99,9 @@ class LdapAuthenticationBackend(ModelBackend):
|
||||||
return user
|
return user
|
||||||
|
|
||||||
def get_user(self, user_id):
|
def get_user(self, user_id):
|
||||||
print("get_user")
|
if not settings.LDAP_ENABLED:
|
||||||
|
return None
|
||||||
|
print("get_user_ldap")
|
||||||
try:
|
try:
|
||||||
return User.objects.get(pk=user_id)
|
return User.objects.get(pk=user_id)
|
||||||
except User.DoesNotExist:
|
except User.DoesNotExist:
|
||||||
|
|
|
||||||
|
|
@ -214,6 +214,7 @@ OTP_ENABLED = False
|
||||||
|
|
||||||
LOGIN_REQUIRED_IGNORE_VIEW_NAMES = ["accounts:email_otp"]
|
LOGIN_REQUIRED_IGNORE_VIEW_NAMES = ["accounts:email_otp"]
|
||||||
|
|
||||||
|
LDAP_ENABLED = False
|
||||||
LDAP_URL = '192.168.1.67'
|
LDAP_URL = '192.168.1.67'
|
||||||
LDAP_PORT = 389
|
LDAP_PORT = 389
|
||||||
USE_SSL = False
|
USE_SSL = False
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue