Merge pull request #21517 from owncloud/ext-oauth-fix

Fix OAuth external storage auth for step 2
This commit is contained in:
Thomas Müller 2016-01-11 13:36:58 +01:00
commit c1d8a03662
2 changed files with 82 additions and 78 deletions

View File

@ -1,6 +1,6 @@
$(document).ready(function() { $(document).ready(function() {
OCA.External.Settings.mountConfig.whenSelectAuthMechanism(function($tr, authMechanism, scheme) { OCA.External.Settings.mountConfig.whenSelectAuthMechanism(function($tr, authMechanism, scheme, onCompletion) {
if (authMechanism === 'oauth1::oauth1') { if (authMechanism === 'oauth1::oauth1') {
var config = $tr.find('.configuration'); var config = $tr.find('.configuration');
config.append($(document.createElement('input')) config.append($(document.createElement('input'))
@ -10,6 +10,7 @@ $(document).ready(function() {
.attr('name', 'oauth1_grant') .attr('name', 'oauth1_grant')
); );
onCompletion.then(function() {
var configured = $tr.find('[data-parameter="configured"]'); var configured = $tr.find('[data-parameter="configured"]');
if ($(configured).val() == 'true') { if ($(configured).val() == 'true') {
$tr.find('.configuration input').attr('disabled', 'disabled'); $tr.find('.configuration input').attr('disabled', 'disabled');
@ -43,6 +44,7 @@ $(document).ready(function() {
} }
} }
} }
});
} }
}); });

View File

@ -1,6 +1,6 @@
$(document).ready(function() { $(document).ready(function() {
OCA.External.Settings.mountConfig.whenSelectAuthMechanism(function($tr, authMechanism, scheme) { OCA.External.Settings.mountConfig.whenSelectAuthMechanism(function($tr, authMechanism, scheme, onCompletion) {
if (authMechanism === 'oauth2::oauth2') { if (authMechanism === 'oauth2::oauth2') {
var config = $tr.find('.configuration'); var config = $tr.find('.configuration');
config.append($(document.createElement('input')) config.append($(document.createElement('input'))
@ -10,6 +10,7 @@ $(document).ready(function() {
.attr('name', 'oauth2_grant') .attr('name', 'oauth2_grant')
); );
onCompletion.then(function() {
var configured = $tr.find('[data-parameter="configured"]'); var configured = $tr.find('[data-parameter="configured"]');
if ($(configured).val() == 'true') { if ($(configured).val() == 'true') {
$tr.find('.configuration input').attr('disabled', 'disabled'); $tr.find('.configuration input').attr('disabled', 'disabled');
@ -58,6 +59,7 @@ $(document).ready(function() {
} }
} }
} }
});
} }
}); });