Merge pull request #25051 from owncloud/2fa-raw-php-files

Check 2FA state for raw php files too
This commit is contained in:
Vincent Petry 2016-06-10 11:56:21 +02:00 committed by GitHub
commit a0d8702a1c
2 changed files with 8 additions and 1 deletions

View File

@ -64,7 +64,9 @@ class OC_JSON{
* @deprecated Use annotation based ACLs from the AppFramework instead * @deprecated Use annotation based ACLs from the AppFramework instead
*/ */
public static function checkLoggedIn() { public static function checkLoggedIn() {
if( !OC_User::isLoggedIn()) { $twoFactorAuthManger = \OC::$server->getTwoFactorAuthManager();
if( !OC_User::isLoggedIn()
|| $twoFactorAuthManger->needsSecondFactor()) {
$l = \OC::$server->getL10N('lib'); $l = \OC::$server->getL10N('lib');
http_response_code(\OCP\AppFramework\Http::STATUS_UNAUTHORIZED); http_response_code(\OCP\AppFramework\Http::STATUS_UNAUTHORIZED);
self::error(array( 'data' => array( 'message' => $l->t('Authentication error'), 'error' => 'authentication_error' ))); self::error(array( 'data' => array( 'message' => $l->t('Authentication error'), 'error' => 'authentication_error' )));

View File

@ -970,6 +970,11 @@ class OC_Util {
); );
exit(); exit();
} }
// Redirect to index page if 2FA challenge was not solved yet
if (\OC::$server->getTwoFactorAuthManager()->needsSecondFactor()) {
header('Location: ' . \OCP\Util::linkToAbsolute('', 'index.php'));
exit();
}
} }
/** /**