From 6345d0687171e8f425dd7bea2b4aa2dc65a7ab9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Mon, 26 Feb 2018 22:05:09 +0100 Subject: [PATCH] Handle login in old ajax endpoints which use OCP\JSON::checkLoggedIn(); --- lib/private/legacy/json.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/private/legacy/json.php b/lib/private/legacy/json.php index 35842c7754f3..e0bb112d8b0e 100644 --- a/lib/private/legacy/json.php +++ b/lib/private/legacy/json.php @@ -67,6 +67,12 @@ public static function checkAppEnabled($app) { * @deprecated Use annotation based ACLs from the AppFramework instead */ public static function checkLoggedIn() { + static $loginCalled = false; + if (!$loginCalled) { + \OC::handleLogin(\OC::$server->getRequest()); + $loginCalled = true; + } + $twoFactorAuthManger = \OC::$server->getTwoFactorAuthManager(); if( !OC_User::isLoggedIn() || $twoFactorAuthManger->needsSecondFactor()) {