Skip to content

Commit

Permalink
improve ldap user login (#5714)
Browse files Browse the repository at this point in the history
  • Loading branch information
likesclever authored Oct 27, 2023
1 parent 6a7e457 commit 5e0372f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions seahub/base/accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

from seahub.settings import ENABLE_LDAP, LDAP_USER_FIRST_NAME_ATTR, LDAP_USER_LAST_NAME_ATTR, \
LDAP_USER_NAME_REVERSE, LDAP_FILTER, LDAP_CONTACT_EMAIL_ATTR, LDAP_USER_ROLE_ATTR, \
ACTIVATE_USER_WHEN_IMPORT, ENABLE_SASL, SASL_MECHANISM, SASL_AUTHC_ID_ATTR
ENABLE_SASL, SASL_MECHANISM, SASL_AUTHC_ID_ATTR

LDAP_PROVIDER = getattr(settings, 'LDAP_PROVIDER', 'ldap')
try:
Expand Down Expand Up @@ -968,7 +968,7 @@ def authenticate(self, ldap_user=None, password=None):

if not user:
try:
user = User.objects.create_ldap_user(is_active=ACTIVATE_USER_WHEN_IMPORT)
user = User.objects.create_ldap_user(is_active=True)
SocialAuthUser.objects.add(user.username, ldap_provider, login_attr)
except Exception as e:
logger.error(f'recreate ldap user failed. {e}')
Expand Down

0 comments on commit 5e0372f

Please sign in to comment.