ported dyn reg to new error handler
parent
40863f4696
commit
cdf5147706
|
@ -102,7 +102,7 @@ var DynRegRootView = Backbone.View.extend({
|
||||||
$('#loadingbox').sheet('show');
|
$('#loadingbox').sheet('show');
|
||||||
$('#loading').html('<span class="label" id="loading-scopes">' + $.t('common.scopes') + '</span> ');
|
$('#loading').html('<span class="label" id="loading-scopes">' + $.t('common.scopes') + '</span> ');
|
||||||
|
|
||||||
$.when(this.options.systemScopeList.fetchIfNeeded({success:function(e) {$('#loading-scopes').addClass('label-success');}}))
|
$.when(this.options.systemScopeList.fetchIfNeeded({success:function(e) {$('#loading-scopes').addClass('label-success');}, error:app.errorHandlerView.handleError()}))
|
||||||
.done(function() {
|
.done(function() {
|
||||||
$('#loadingbox').sheet('hide');
|
$('#loadingbox').sheet('hide');
|
||||||
callback();
|
callback();
|
||||||
|
@ -133,7 +133,8 @@ var DynRegRootView = Backbone.View.extend({
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
client.fetch({success: function() {
|
client.fetch({
|
||||||
|
success: function() {
|
||||||
|
|
||||||
var userInfo = getUserInfo();
|
var userInfo = getUserInfo();
|
||||||
var contacts = client.get("contacts");
|
var contacts = client.get("contacts");
|
||||||
|
@ -163,16 +164,8 @@ var DynRegRootView = Backbone.View.extend({
|
||||||
app.navigate('dev/dynreg/edit', {trigger: true});
|
app.navigate('dev/dynreg/edit', {trigger: true});
|
||||||
self.remove();
|
self.remove();
|
||||||
});
|
});
|
||||||
}, error: function() {
|
}, error:app.errorHandlerView.handleError({message: $.t('dynreg.invalid-access-token')})
|
||||||
$('#modalAlert div.modal-body').html($.t('dynreg.invalid-access-token'));
|
|
||||||
|
|
||||||
$("#modalAlert").modal({ // wire up the actual modal functionality and show the dialog
|
|
||||||
"backdrop" : "static",
|
|
||||||
"keyboard" : true,
|
|
||||||
"show" : true // ensure the modal is shown immediately
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -207,7 +200,7 @@ var DynRegEditView = Backbone.View.extend({
|
||||||
$('#loadingbox').sheet('show');
|
$('#loadingbox').sheet('show');
|
||||||
$('#loading').html('<span class="label" id="loading-scopes">' + $.t('common.scopes') + '</span> ');
|
$('#loading').html('<span class="label" id="loading-scopes">' + $.t('common.scopes') + '</span> ');
|
||||||
|
|
||||||
$.when(this.options.systemScopeList.fetchIfNeeded({success:function(e) {$('#loading-scopes').addClass('label-success');}}))
|
$.when(this.options.systemScopeList.fetchIfNeeded({success:function(e) {$('#loading-scopes').addClass('label-success');}, error:app.errorHandlerView.handleError()}))
|
||||||
.done(function() {
|
.done(function() {
|
||||||
$('#loadingbox').sheet('hide');
|
$('#loadingbox').sheet('hide');
|
||||||
callback();
|
callback();
|
||||||
|
@ -240,22 +233,7 @@ var DynRegEditView = Backbone.View.extend({
|
||||||
self.remove();
|
self.remove();
|
||||||
app.navigate('dev/dynreg', {trigger: true});
|
app.navigate('dev/dynreg', {trigger: true});
|
||||||
},
|
},
|
||||||
error:function (error, response) {
|
error:app.errorHandlerView.handleError({"log": "An error occurred when deleting a client"})
|
||||||
console.log("An error occurred when deleting a client");
|
|
||||||
|
|
||||||
//Pull out the response text.
|
|
||||||
var responseJson = JSON.parse(response.responseText);
|
|
||||||
|
|
||||||
//Display an alert with an error message
|
|
||||||
$('#modalAlert div.modal-header').html(responseJson.error);
|
|
||||||
$('#modalAlert div.modal-body').html(responseJson.error_description);
|
|
||||||
|
|
||||||
$("#modalAlert").modal({ // wire up the actual modal functionality and show the dialog
|
|
||||||
"backdrop" : "static",
|
|
||||||
"keyboard" : true,
|
|
||||||
"show" : true // ensure the modal is shown immediately
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -397,15 +375,7 @@ var DynRegEditView = Backbone.View.extend({
|
||||||
var sectorIdentifierUri = $('#sectorIdentifierUri input').val();
|
var sectorIdentifierUri = $('#sectorIdentifierUri input').val();
|
||||||
if (subjectType == 'PAIRWISE' && redirectUris.length > 1 && sectorIdentifierUri == '') {
|
if (subjectType == 'PAIRWISE' && redirectUris.length > 1 && sectorIdentifierUri == '') {
|
||||||
//Display an alert with an error message
|
//Display an alert with an error message
|
||||||
$('#modalAlert div.modal-header').html("Consistency error");
|
app.errorHandlerView.showErrorMessage($.t("client.client-form.error.consistency"), $.t("client.client-form.error.pairwise-sector"));
|
||||||
$('#modalAlert div.modal-body').html("Pairwise identifiers cannot be used with multiple redirect URIs unless a sector identifier URI is also registered.");
|
|
||||||
|
|
||||||
$("#modalAlert").modal({ // wire up the actual modal functionality and show the dialog
|
|
||||||
"backdrop" : "static",
|
|
||||||
"keyboard" : true,
|
|
||||||
"show" : true // ensure the modal is shown immediately
|
|
||||||
});
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -424,17 +394,7 @@ var DynRegEditView = Backbone.View.extend({
|
||||||
jwks = JSON.parse($('#jwks textarea').val());
|
jwks = JSON.parse($('#jwks textarea').val());
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log("An error occurred when parsing the JWK Set");
|
console.log("An error occurred when parsing the JWK Set");
|
||||||
|
app.errorHandlerView.showErrorMessage($.t("client.client-form.error.jwk-set"), $.t("client.client-form.error.jwk-set-parse"));
|
||||||
//Display an alert with an error message
|
|
||||||
$('#modalAlert div.modal-header').html("JWK Set Error");
|
|
||||||
$('#modalAlert div.modal-body').html("There was an error parsing the public key from the JSON Web Key set. Check the value and try again.");
|
|
||||||
|
|
||||||
$("#modalAlert").modal({ // wire up the actual modal functionality and show the dialog
|
|
||||||
"backdrop" : "static",
|
|
||||||
"keyboard" : true,
|
|
||||||
"show" : true // ensure the modal is shown immediately
|
|
||||||
});
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -518,22 +478,7 @@ var DynRegEditView = Backbone.View.extend({
|
||||||
view.delegateEvents();
|
view.delegateEvents();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
error:function (error, response) {
|
error:app.errorHandlerView.handleError({log: "An error occurred when saving a client"})
|
||||||
console.log("An error occurred when saving the client");
|
|
||||||
|
|
||||||
//Pull out the response text.
|
|
||||||
var responseJson = JSON.parse(response.responseText);
|
|
||||||
|
|
||||||
//Display an alert with an error message
|
|
||||||
$('#modalAlert div.modal-header').html(responseJson.error);
|
|
||||||
$('#modalAlert div.modal-body').html(responseJson.error_description);
|
|
||||||
|
|
||||||
$("#modalAlert").modal({ // wire up the actual modal functionality and show the dialog
|
|
||||||
"backdrop" : "static",
|
|
||||||
"keyboard" : true,
|
|
||||||
"show" : true // ensure the modal is shown immediately
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue