diff options
author | Robin McCorkell <rmccorkell@owncloud.com> | 2015-11-22 17:25:32 +0000 |
---|---|---|
committer | Robin McCorkell <rmccorkell@owncloud.com> | 2015-11-22 17:25:32 +0000 |
commit | 08839ce77dcf23ae12725bd47e58c1bab5ea4aaf (patch) | |
tree | 73f82ca876e48777ebf1431c1f369a0d719f743b /apps/files_external/js/public_key.js | |
parent | ee7128b43549ed2ce1e8a96c132503809ac87ba9 (diff) | |
download | nextcloud-server-08839ce77dcf23ae12725bd47e58c1bab5ea4aaf.tar.gz nextcloud-server-08839ce77dcf23ae12725bd47e58c1bab5ea4aaf.zip |
Defer initialisation of data until after complete construction
Diffstat (limited to 'apps/files_external/js/public_key.js')
-rw-r--r-- | apps/files_external/js/public_key.js | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/apps/files_external/js/public_key.js b/apps/files_external/js/public_key.js index e35d7ad3789..5f9658381f0 100644 --- a/apps/files_external/js/public_key.js +++ b/apps/files_external/js/public_key.js @@ -1,10 +1,16 @@ $(document).ready(function() { - OCA.External.Settings.mountConfig.whenSelectAuthMechanism(function($tr, authMechanism, scheme) { + OCA.External.Settings.mountConfig.whenSelectAuthMechanism(function($tr, authMechanism, scheme, onCompletion) { if (scheme === 'publickey') { var config = $tr.find('.configuration'); if ($(config).find('[name="public_key_generate"]').length === 0) { setupTableRow($tr, config); + onCompletion.then(function() { + // If there's no private key, build one + if (0 === $(config).find('[data-parameter="private_key"]').val().length) { + generateKeys($tr); + } + }); } } }); @@ -22,10 +28,6 @@ $(document).ready(function() { .attr('value', t('files_external', 'Generate keys')) .attr('name', 'public_key_generate') ); - // If there's no private key, build one - if (0 === $(config).find('[data-parameter="private_key"]').val().length) { - generateKeys(tr); - } } function generateKeys(tr) { |