|
|
@@ -422,7 +422,7 @@ class PamBackend(DesktopBackendBase):
|
|
|
username = force_username_case(username)
|
|
|
|
|
|
if AUTH.PAM_USE_PWD_MODULE.get():
|
|
|
- LOG.debug('setting username to %s using pam pwd module for user %s' % (getpwnam(username).pw_name, username))
|
|
|
+ LOG.debug('Setting username to %s using PAM pwd module for user %s' % (getpwnam(username).pw_name, username))
|
|
|
username = getpwnam(username).pw_name
|
|
|
|
|
|
if pam.authenticate(username, password, AUTH.PAM_SERVICE.get()):
|
|
|
@@ -594,6 +594,14 @@ class LdapBackend(object):
|
|
|
LOG.warning("LDAP was not properly configured: %s", detail)
|
|
|
return None
|
|
|
|
|
|
+ if AUTH.PAM_USE_PWD_MODULE.get():
|
|
|
+ LOG.debug('Setting LDAP username to %s using PAM pwd module for user %s' % (getpwnam(username).pw_name, username))
|
|
|
+ pam_user = getpwnam(username).pw_name
|
|
|
+ try:
|
|
|
+ user = User.objects.get(username__iexact=pam_user)
|
|
|
+ except User.DoesNotExist:
|
|
|
+ user = find_or_create_user(pam_user, None)
|
|
|
+
|
|
|
if user is not None and user.is_active:
|
|
|
profile = get_profile(user)
|
|
|
profile.creation_method = UserProfile.CreationMethod.EXTERNAL.name
|