]> Frank Brehm's Git Trees - pixelpark/pp-admin-tools.git/commitdiff
Asking for a password on instancing all LDAP instances if none was configured.
authorFrank Brehm <frank@brehm-online.com>
Fri, 30 Sep 2022 09:43:20 +0000 (11:43 +0200)
committerFrank Brehm <frank@brehm-online.com>
Fri, 30 Sep 2022 09:43:20 +0000 (11:43 +0200)
lib/pp_admintools/app/ldap.py

index 1a13515d7a5c70e6afcfa6151392358a4a425808..d57d9220635edc2ddf148ba9460ac045f3920c91 100644 (file)
@@ -50,7 +50,7 @@ from ..config.ldap import LdapConnectionInfo, LdapConfiguration
 # rom ..config.ldap import DEFAULT_PORT_LDAP, DEFAULT_PORT_LDAPS
 from ..config.ldap import DEFAULT_TIMEOUT
 
-__version__ = '0.7.2'
+__version__ = '0.7.3'
 LOG = logging.getLogger(__name__)
 
 _ = XLATOR.gettext
@@ -577,6 +577,12 @@ class BaseLdapApplication(BaseDPXApplication):
         ldap_server = self.get_ldap_server_obj(inst)
         self.ldap_server[inst] = ldap_server
 
+        if not connect_info.bind_pw:
+            first_prompt = _("Password of user {usr} on LDAP instance {inst}:").format(
+                usr=self.colored(connect_info.bind_dn, 'CYAN'),
+                inst=self.colored(connect_info.url, 'CYAN')) + ' '
+            connect_info.bind_pw = self.get_password(first_prompt, may_empty=False, repeat=False)
+
         ldap_connection = self.connect_to_ldap_server(ldap_server, inst)
         self.ldap_connection[inst] = ldap_connection