From 45c8d2df2dd91ce14cf4c4df24e88312e953cb0a Mon Sep 17 00:00:00 2001 From: wangjianhua Date: Fri, 21 Oct 2022 14:54:47 +0800 Subject: [PATCH] * Convert LDAP port to string. --- frontend/module/system/js/editldap.js | 9 +++++++++ frontend/module/system/js/installldap.js | 9 +++++++++ frontend/module/system/lang/zh-cn.php | 12 +++++++----- frontend/module/system/model.php | 2 +- frontend/module/system/view/editldap.html.php | 1 + frontend/module/system/view/installldap.html.php | 1 + 6 files changed, 28 insertions(+), 6 deletions(-) diff --git a/frontend/module/system/js/editldap.js b/frontend/module/system/js/editldap.js index ee139dff..cf5d7e8d 100644 --- a/frontend/module/system/js/editldap.js +++ b/frontend/module/system/js/editldap.js @@ -51,6 +51,15 @@ $(function() settings.bindDN = $('input[name="extra[bindDN]"]').val(); settings.bindPass = $('input[name="extra[bindPass]"]').val(); settings.baseDN = $('input[name="extra[baseDN]"]').val(); + if(!settings.host || !settings.port || !settings.bindDN || !settings.bindPass || !settings.baseDN) + { + bootbox.alert( + { + title: notices.attention, + message: notices.fillAllRequiredFields, + }); + return; + } $.post(createLink('system', 'testLDAPConnection'), settings).done(function(response) { diff --git a/frontend/module/system/js/installldap.js b/frontend/module/system/js/installldap.js index a4843ef7..e69cb1c4 100644 --- a/frontend/module/system/js/installldap.js +++ b/frontend/module/system/js/installldap.js @@ -51,6 +51,15 @@ $(function() settings.bindDN = $('input[name="extra[bindDN]"]').val(); settings.bindPass = $('input[name="extra[bindPass]"]').val(); settings.baseDN = $('input[name="extra[baseDN]"]').val(); + if(!settings.host || !settings.port || !settings.bindDN || !settings.bindPass || !settings.baseDN) + { + bootbox.alert( + { + title: notices.attention, + message: notices.fillAllRequiredFields, + }); + return; + } $.post(createLink('system', 'testLDAPConnection'), settings).done(function(response) { diff --git a/frontend/module/system/lang/zh-cn.php b/frontend/module/system/lang/zh-cn.php index 298a1051..324e6692 100644 --- a/frontend/module/system/lang/zh-cn.php +++ b/frontend/module/system/lang/zh-cn.php @@ -42,11 +42,13 @@ $lang->system->ldapTypeList['extra'] = '外部映射'; $lang->system->notices = new stdclass; -$lang->system->notices->noLDAP = '找不到LDAP配置数据'; -$lang->system->notices->ldapUsed = '已经有服务关联了LDAP'; -$lang->system->notices->ldapInstallSuccess = 'LDAP安装成功'; -$lang->system->notices->ldapUpdateSuccess = 'LDAP更新成功'; -$lang->system->notices->verifyLDAPSuccess = '校验LDAP成功!'; +$lang->system->notices->attention = '注意'; +$lang->system->notices->noLDAP = '找不到LDAP配置数据'; +$lang->system->notices->ldapUsed = '已经有服务关联了LDAP'; +$lang->system->notices->ldapInstallSuccess = 'LDAP安装成功'; +$lang->system->notices->ldapUpdateSuccess = 'LDAP更新成功'; +$lang->system->notices->verifyLDAPSuccess = '校验LDAP成功!'; +$lang->system->notices->fillAllRequiredFields = '请填写全部必填项!'; $lang->system->errors = new stdclass; $lang->system->errors->notFoundDB = '找不到该数据库'; diff --git a/frontend/module/system/model.php b/frontend/module/system/model.php index e00a82ce..143534e1 100644 --- a/frontend/module/system/model.php +++ b/frontend/module/system/model.php @@ -172,7 +172,7 @@ public function installExtraLDAP($settings, $action='install') $snippetSettings->values->auth->ldap->enabled = true; $snippetSettings->values->auth->ldap->type = 'ldap'; $snippetSettings->values->auth->ldap->host = $settings->host; - $snippetSettings->values->auth->ldap->port = intval($settings->port); + $snippetSettings->values->auth->ldap->port = strval($settings->port); $snippetSettings->values->auth->ldap->bindDN = "cn={$settings->bindDN},{$settings->baseDN}"; $snippetSettings->values->auth->ldap->bindPass = $settings->bindPass; $snippetSettings->values->auth->ldap->baseDN = $settings->baseDN; diff --git a/frontend/module/system/view/editldap.html.php b/frontend/module/system/view/editldap.html.php index 9e918c41..c3c0b16b 100644 --- a/frontend/module/system/view/editldap.html.php +++ b/frontend/module/system/view/editldap.html.php @@ -13,6 +13,7 @@ app->getModuleRoot() . '/common/view/header.html.php';?> loadModel('instance')->countLDAP();?> system->errors);?> +system->notices);?>