From b9e53097577499b519f9fcdd053421cb1507bab3 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Thu, 7 May 2015 21:09:10 +0200 Subject: catch unallowed anonymous auth attempt and show specific error --- apps/user_ldap/js/wizard/wizardTabElementary.js | 9 ++++++++- apps/user_ldap/js/wizard/wizardTabGeneric.js | 5 +++++ apps/user_ldap/js/wizard/wizardTabUserFilter.js | 6 ++++++ 3 files changed, 19 insertions(+), 1 deletion(-) (limited to 'apps/user_ldap/js') diff --git a/apps/user_ldap/js/wizard/wizardTabElementary.js b/apps/user_ldap/js/wizard/wizardTabElementary.js index b8ab367dfd1..75664275a9c 100644 --- a/apps/user_ldap/js/wizard/wizardTabElementary.js +++ b/apps/user_ldap/js/wizard/wizardTabElementary.js @@ -165,6 +165,12 @@ OCA = OCA || {}; * @inheritdoc */ overrideErrorMessage: function(message, key) { + var original = message; + message = this._super(message, key); + if(original !== message) { + // we pass the parents change + return message; + } switch(key) { case 'ldap_port': if (message === 'Invalid credentials') { @@ -267,7 +273,8 @@ OCA = OCA || {}; message = t('user_ldap', objectsFound + ' entries available within the provided Base DN'); } } else { - message = t('user_ldap', 'An error occurred. Please check the Base DN, as well as connection settings and credentials.'); + message = view.overrideErrorMessage(payload.data.message); + message = message || t('user_ldap', 'An error occurred. Please check the Base DN, as well as connection settings and credentials.'); if(payload.data.message) { console.warn(payload.data.message); } diff --git a/apps/user_ldap/js/wizard/wizardTabGeneric.js b/apps/user_ldap/js/wizard/wizardTabGeneric.js index 720628fa609..c272df7e3cc 100644 --- a/apps/user_ldap/js/wizard/wizardTabGeneric.js +++ b/apps/user_ldap/js/wizard/wizardTabGeneric.js @@ -70,6 +70,11 @@ OCA = OCA || {}; * @returns {string} */ overrideErrorMessage: function(message, key) { + if(message === 'LDAP authentication method rejected' + && !this.configModel.configuration.ldap_dn) + { + message = t('user_ldap', 'Anonymous bind is not allowed. Please provide a User DN and Password.'); + } return message; }, diff --git a/apps/user_ldap/js/wizard/wizardTabUserFilter.js b/apps/user_ldap/js/wizard/wizardTabUserFilter.js index 992c1ccf379..4fe223ee075 100644 --- a/apps/user_ldap/js/wizard/wizardTabUserFilter.js +++ b/apps/user_ldap/js/wizard/wizardTabUserFilter.js @@ -122,6 +122,12 @@ OCA = OCA || {}; * @inheritdoc */ overrideErrorMessage: function(message, key) { + var original = message; + message = this._super(message, key); + if(original !== message) { + // we pass the parents change + return message; + } if( key === 'ldap_userfilter_groups' && message === 'memberOf is not supported by the server' ) { -- cgit v1.2.3