Improve exposed ldap error reporting

This commit is contained in:
Johannes Zellner
2021-12-10 17:47:23 +01:00
parent c775e8ae05
commit eaa7e3870b
3 changed files with 9 additions and 10 deletions

View File

@@ -692,7 +692,7 @@ angular.module('Application').controller('UsersController', ['$scope', '$locatio
$scope.exposedLdapConfig = {
enabled: false,
allowlist: '',
error: '',
error: null,
refresh: function () {
Client.getExposedLdapConfig(function (error, result) {
@@ -704,7 +704,7 @@ angular.module('Application').controller('UsersController', ['$scope', '$locatio
},
submit: function () {
$scope.exposedLdapConfig.error = '';
$scope.exposedLdapConfig.error = null;
$scope.exposedLdapConfig.busy = true;
$scope.exposedLdapConfig.success = false;
@@ -714,16 +714,15 @@ angular.module('Application').controller('UsersController', ['$scope', '$locatio
};
Client.setExposedLdapConfig(data, function (error) {
if (error) $scope.exposedLdapConfig.error = error.message;
$scope.exposedLdapConfig.busy = false;
$scope.exposedLdapConfig.success = true;
if (error && error.statusCode === 400) return $scope.exposedLdapConfig.error = { allowlist: error.message };
if (error) return $scope.exposedLdapConfig.error = { generic: error.message };
$scope.exposedLdapConfigForm.$setUntouched();
$scope.exposedLdapConfigForm.$setPristine();
$timeout(function () {
$scope.exposedLdapConfig.busy = false;
}, 3000);
$scope.exposedLdapConfig.success = true;
});
}
};