diff options
author | Vincent Petry <pvince81@owncloud.com> | 2015-08-26 10:30:24 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2015-08-26 10:52:43 +0200 |
commit | 90ed32ebc509edc5bf4978c304db79e6140d2b09 (patch) | |
tree | 514089643b94c015e099282e072a8c41cc6f5bb3 /core/ajax | |
parent | 08a490df32e7744be5e5f47067746591e7fac05a (diff) | |
download | nextcloud-server-90ed32ebc509edc5bf4978c304db79e6140d2b09.tar.gz nextcloud-server-90ed32ebc509edc5bf4978c304db79e6140d2b09.zip |
Properly show token errors in ajax/update.php event source
Diffstat (limited to 'core/ajax')
-rw-r--r-- | core/ajax/update.php | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/core/ajax/update.php b/core/ajax/update.php index 14b4f913f76..c25ef1b9084 100644 --- a/core/ajax/update.php +++ b/core/ajax/update.php @@ -28,15 +28,19 @@ set_time_limit(0); require_once '../../lib/base.php'; -\OCP\JSON::callCheck(); +$l = \OC::$server->getL10N('core'); + +$eventSource = \OC::$server->createEventSource(); +// need to send an initial message to force-init the event source, +// which will then trigger its own CSRF check and produces its own CSRF error +// message +$eventSource->send('success', (string)$l->t('Preparing update')); if (OC::checkUpgrade(false)) { // if a user is currently logged in, their session must be ignored to // avoid side effects \OC_User::setIncognitoMode(true); - $l = new \OC_L10N('core'); - $eventSource = \OC::$server->createEventSource(); $logger = \OC::$server->getLogger(); $updater = new \OC\Updater( \OC::$server->getHTTPHelper(), @@ -96,6 +100,10 @@ if (OC::checkUpgrade(false)) { (string)$l->t('Following apps have been disabled: %s', implode(', ', $disabledThirdPartyApps))); } - $eventSource->send('done', ''); - $eventSource->close(); +} else { + $eventSource->send('notice', (string)$l->t('Already up to date')); } + +$eventSource->send('done', ''); +$eventSource->close(); + |