Improve exposed ldap error reporting
This commit is contained in:
@@ -887,8 +887,8 @@
|
||||
<div class="form-group">
|
||||
<label class="control-label">{{ 'users.exposedLdap.ipRestriction.label' | tr }}</label>
|
||||
<p class="small">{{ 'users.exposedLdap.ipRestriction.description' | tr }}</p>
|
||||
<div class="has-error" ng-show="exposedLdapConfig.error.allowlist">{{ exposedLdapConfig.error.allowlist }}</div>
|
||||
<textarea ng-model="exposedLdapConfig.allowlist" placeholder="{{ 'users.exposedLdap.ipRestriction.placeholder' | tr }}" name="allowlist" class="form-control" ng-class="{ 'has-error': !exposedLdapConfigForm.allowlist.$dirty && exposedLdapConfig.error.allowlist }" rows="4"></textarea>
|
||||
<div class="has-error" ng-show="exposedLdapConfig.error.allowlist">{{ exposedLdapConfig.error.allowlist }}</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
@@ -896,7 +896,7 @@
|
||||
<br/>
|
||||
|
||||
<div>
|
||||
<span class="has-error" ng-show="exposedLdapConfig.error">{{ exposedLdapConfig.error }}</span>
|
||||
<span class="has-error" ng-show="exposedLdapConfig.error.generic">{{ exposedLdapConfig.error.generic }}</span>
|
||||
|
||||
<button class="btn btn-outline btn-primary pull-right" ng-click="exposedLdapConfig.submit()" ng-disabled="!exposedLdapConfigForm.$dirty || exposedLdapConfig.busy">
|
||||
<i class="fa fa-circle-notch fa-spin" ng-show="exposedLdapConfig.busy"></i> {{ 'users.settings.saveAction' | tr }}
|
||||
|
||||
@@ -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;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user