diff options
author | Morris Jobke <hey@morrisjobke.de> | 2019-01-08 12:32:53 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-08 12:32:53 +0100 |
commit | 8f7839ef3e5c11137a7da2713df5449c2bcf832b (patch) | |
tree | a73db9bd0cff52b9f1f3d6f231707d30805b4b35 /settings | |
parent | 3690e086e74bb0a12b82ab1a4ba05dee81f8c3f9 (diff) | |
parent | 51f0651d6837e0120e7fc8aa372a250ba1562eb2 (diff) | |
download | nextcloud-server-8f7839ef3e5c11137a7da2713df5449c2bcf832b.tar.gz nextcloud-server-8f7839ef3e5c11137a7da2713df5449c2bcf832b.zip |
Merge pull request #12899 from nextcloud/feature/run-setupcheck-on-overwie
Run setupchecks when #security-warnings is present
Diffstat (limited to 'settings')
-rw-r--r-- | settings/js/admin.js | 120 |
1 files changed, 63 insertions, 57 deletions
diff --git a/settings/js/admin.js b/settings/js/admin.js index 8c198bc7821..b93c55a8a9c 100644 --- a/settings/js/admin.js +++ b/settings/js/admin.js @@ -244,67 +244,73 @@ $(document).ready(function(){ $("#selectExcludedGroups").toggleClass('hidden', !this.checked); }); - // run setup checks then gather error messages - $.when( - OC.SetupChecks.checkWebDAV(), - OC.SetupChecks.checkWellKnownUrl('/.well-known/webfinger', oc_defaults.docPlaceholderUrl, $('#postsetupchecks').data('check-wellknown') === true && !!oc_appconfig.core.public_webfinger, [200, 501]), - OC.SetupChecks.checkWellKnownUrl('/.well-known/caldav', oc_defaults.docPlaceholderUrl, $('#postsetupchecks').data('check-wellknown') === true), - OC.SetupChecks.checkWellKnownUrl('/.well-known/carddav', oc_defaults.docPlaceholderUrl, $('#postsetupchecks').data('check-wellknown') === true), - OC.SetupChecks.checkSetup(), - OC.SetupChecks.checkGeneric(), - OC.SetupChecks.checkWOFF2Loading(OC.filePath('core', '', 'fonts/Nunito-Regular.woff2'), oc_defaults.docPlaceholderUrl), - OC.SetupChecks.checkDataProtected() - ).then(function(check1, check2, check3, check4, check5, check6, check7, check8) { - var messages = [].concat(check1, check2, check3, check4, check5, check6, check7, check8); - var $el = $('#postsetupchecks'); - $('#security-warning-state-loading').addClass('hidden'); - - var hasMessages = false; - var $errorsEl = $el.find('.errors'); - var $warningsEl = $el.find('.warnings'); - var $infoEl = $el.find('.info'); - - for (var i = 0; i < messages.length; i++ ) { - switch(messages[i].type) { - case OC.SetupChecks.MESSAGE_TYPE_INFO: - $infoEl.append('<li>' + messages[i].msg + '</li>'); - break; - case OC.SetupChecks.MESSAGE_TYPE_WARNING: - $warningsEl.append('<li>' + messages[i].msg + '</li>'); - break; - case OC.SetupChecks.MESSAGE_TYPE_ERROR: - default: - $errorsEl.append('<li>' + messages[i].msg + '</li>'); + var setupChecks = function () { + // run setup checks then gather error messages + $.when( + OC.SetupChecks.checkWebDAV(), + OC.SetupChecks.checkWellKnownUrl('/.well-known/webfinger', oc_defaults.docPlaceholderUrl, $('#postsetupchecks').data('check-wellknown') === true && !!oc_appconfig.core.public_webfinger, [200, 501]), + OC.SetupChecks.checkWellKnownUrl('/.well-known/caldav', oc_defaults.docPlaceholderUrl, $('#postsetupchecks').data('check-wellknown') === true), + OC.SetupChecks.checkWellKnownUrl('/.well-known/carddav', oc_defaults.docPlaceholderUrl, $('#postsetupchecks').data('check-wellknown') === true), + OC.SetupChecks.checkSetup(), + OC.SetupChecks.checkGeneric(), + OC.SetupChecks.checkWOFF2Loading(OC.filePath('core', '', 'fonts/Nunito-Regular.woff2'), oc_defaults.docPlaceholderUrl), + OC.SetupChecks.checkDataProtected() + ).then(function (check1, check2, check3, check4, check5, check6, check7, check8) { + var messages = [].concat(check1, check2, check3, check4, check5, check6, check7, check8); + var $el = $('#postsetupchecks'); + $('#security-warning-state-loading').addClass('hidden'); + + var hasMessages = false; + var $errorsEl = $el.find('.errors'); + var $warningsEl = $el.find('.warnings'); + var $infoEl = $el.find('.info'); + + for (var i = 0; i < messages.length; i++) { + switch (messages[i].type) { + case OC.SetupChecks.MESSAGE_TYPE_INFO: + $infoEl.append('<li>' + messages[i].msg + '</li>'); + break; + case OC.SetupChecks.MESSAGE_TYPE_WARNING: + $warningsEl.append('<li>' + messages[i].msg + '</li>'); + break; + case OC.SetupChecks.MESSAGE_TYPE_ERROR: + default: + $errorsEl.append('<li>' + messages[i].msg + '</li>'); + } } - } - - if ($errorsEl.find('li').length > 0) { - $errorsEl.removeClass('hidden'); - hasMessages = true; - } - if ($warningsEl.find('li').length > 0) { - $warningsEl.removeClass('hidden'); - hasMessages = true; - } - if ($infoEl.find('li').length > 0) { - $infoEl.removeClass('hidden'); - hasMessages = true; - } - if (hasMessages) { - $('#postsetupchecks-hint').removeClass('hidden'); if ($errorsEl.find('li').length > 0) { - $('#security-warning-state-failure').removeClass('hidden'); - } else { - $('#security-warning-state-warning').removeClass('hidden'); + $errorsEl.removeClass('hidden'); + hasMessages = true; } - } else { - var securityWarning = $('#security-warning'); - if (securityWarning.children('ul').children().length === 0) { - $('#security-warning-state-ok').removeClass('hidden'); + if ($warningsEl.find('li').length > 0) { + $warningsEl.removeClass('hidden'); + hasMessages = true; + } + if ($infoEl.find('li').length > 0) { + $infoEl.removeClass('hidden'); + hasMessages = true; + } + + if (hasMessages) { + $('#postsetupchecks-hint').removeClass('hidden'); + if ($errorsEl.find('li').length > 0) { + $('#security-warning-state-failure').removeClass('hidden'); + } else { + $('#security-warning-state-warning').removeClass('hidden'); + } } else { - $('#security-warning-state-failure').removeClass('hidden'); + var securityWarning = $('#security-warning'); + if (securityWarning.children('ul').children().length === 0) { + $('#security-warning-state-ok').removeClass('hidden'); + } else { + $('#security-warning-state-failure').removeClass('hidden'); + } } - } - }); + }); + }; + + if (document.getElementById('security-warning') !== null) { + setupChecks(); + } }); |