From b37de54d5c97a624ec7f5e304e1b16ec1d3cba6f Mon Sep 17 00:00:00 2001 From: edip Date: Tue, 20 Nov 2018 08:19:18 +0300 Subject: [PATCH] ldap config check user and server --- src/base/registration/registration.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/base/registration/registration.py b/src/base/registration/registration.py index 702784a..3648e47 100644 --- a/src/base/registration/registration.py +++ b/src/base/registration/registration.py @@ -105,15 +105,20 @@ class Registration: admin_dn = str(reg_reply['ldapUserDn']) # get user full dn from server.. password same admin_password = self.user_password # same user get from server - (result_code, p_out, p_err) = self.util.execute("/bin/bash /usr/share/ahenk/plugins/ldap-login/scripts/ldap-login.sh {0} {1} {2} {3} {4}".format( - server_address, "\'" + dn + "\'", "\'" + admin_dn + "\'", "\'" + admin_password + "\'", version)) - if result_code == 0: - self.logger.info("Script has run successfully") - self.change_pam_ldap_configs() - else: - self.logger.error("Script could not run successfully: " + p_err) - print("ERROR ---> " + str(p_err)) - raise Exception('LDAP Ayarları yapılırken hata oluştu. Lütfen ağ bağlantınızı kontrol ediniz. Deponuzun güncel olduğundan emin olunuz.') + if server_address != '' and dn != '' and version != '' and admin_dn != '' and admin_password != '': + (result_code, p_out, p_err) = self.util.execute("/bin/bash /usr/share/ahenk/plugins/ldap-login/scripts/ldap-login.sh {0} {1} {2} {3} {4}".format( + server_address, "\'" + dn + "\'", "\'" + admin_dn + "\'", "\'" + admin_password + "\'", version)) + if result_code == 0: + self.logger.info("Script has run successfully") + self.change_pam_ldap_configs() + else: + self.logger.error("Script could not run successfully: " + p_err) + print("ERROR ---> " + str(p_err)) + raise Exception('LDAP Ayarları yapılırken hata oluştu. Lütfen ağ bağlantınızı kontrol ediniz. Deponuzun güncel olduğundan emin olunuz.') + else : + raise Exception( + 'LDAP Ayarları yapılırken hata oluştu. Lütfen ağ bağlantınızı kontrol ediniz. Deponuzun güncel olduğundan emin olunuz.') + def registration_error(self, reg_reply):