fixed javascript bugs

pull/263/head
Justin Richer 2012-12-11 14:08:10 -05:00
parent f12d3c7d30
commit dd04df6a22
1 changed files with 12 additions and 9 deletions

View File

@ -539,12 +539,6 @@
}
});
var allowRefresh = $('#allowRefresh').is(':checked');
if (allowRefresh) {
authorizedGrantTypes.push(this.authorizedGrantMap['refresh_token']);
scopes.push("offline");
}
var requireClientSecret = $('#requireClientSecret input').is(':checked');
var generateClientSecret = $('#generateClientSecret input').is(':checked');
var clientSecret = null;
@ -565,11 +559,19 @@
}
var refreshTokenValiditySeconds = null;
if ($('#allowRefresh').is(':checked') && !$('disableRefreshTokenTimeout').is(':checked')) {
refreshTokenValiditySeconds = this.getFormTokenValue($('#refreshTokenValiditySeconds input[type=text]').val());
if ($('#allowRefresh').is(':checked')) {
if ($.inArray('refresh_token', authorizedGrantTypes) == -1) {
authorizedGrantTypes.push('refresh_token');
}
if ($.inArray('offline', scopes) == -1) {
scopes.push("offline");
}
if (!$('disableRefreshTokenTimeout').is(':checked')) {
refreshTokenValiditySeconds = this.getFormTokenValue($('#refreshTokenValiditySeconds input[type=text]').val());
}
}
var valid = this.model.set({
@ -584,6 +586,7 @@
accessTokenValiditySeconds: accessTokenValiditySeconds,
refreshTokenValiditySeconds: refreshTokenValiditySeconds,
idTokenValiditySeconds: idTokenValiditySeconds,
allowRefresh: $('#allowRefresh').is(':checked'),
scope: scopes
});
@ -1110,7 +1113,7 @@
}, { silent: true });
}
if ($.inArray("refresh_token", client.get("authorizedGrantTypes"))) {
if ($.inArray("refresh_token", client.get("authorizedGrantTypes")) != -1) {
client.set({
allowRefresh: true
}, { silent: true });