summaryrefslogtreecommitdiffstats
path: root/settings/js
diff options
context:
space:
mode:
authorDaniel Kesselberg <mail@danielkesselberg.de>2019-01-05 16:29:57 +0100
committerDaniel Kesselberg <mail@danielkesselberg.de>2019-01-05 16:29:57 +0100
commit51f0651d6837e0120e7fc8aa372a250ba1562eb2 (patch)
tree74981b82c0d8d352adfa50d1cd46571ffaa2d81b /settings/js
parenta1b6333712986fcfbc6317f94a3f3172cfcf113d (diff)
downloadnextcloud-server-51f0651d6837e0120e7fc8aa372a250ba1562eb2.tar.gz
nextcloud-server-51f0651d6837e0120e7fc8aa372a250ba1562eb2.zip
Run setupchecks when #security-warnings is present
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
Diffstat (limited to 'settings/js')
-rw-r--r--settings/js/admin.js120
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();
+ }
});