diff options
Diffstat (limited to 'apps/files/lib')
-rw-r--r-- | apps/files/lib/Controller/ViewController.php | 14 | ||||
-rw-r--r-- | apps/files/lib/Service/UserConfig.php | 6 |
2 files changed, 19 insertions, 1 deletions
diff --git a/apps/files/lib/Controller/ViewController.php b/apps/files/lib/Controller/ViewController.php index 50b0ae558aa..ecf21cef313 100644 --- a/apps/files/lib/Controller/ViewController.php +++ b/apps/files/lib/Controller/ViewController.php @@ -26,6 +26,7 @@ use OCP\AppFramework\Http\RedirectResponse; use OCP\AppFramework\Http\Response; use OCP\AppFramework\Http\TemplateResponse; use OCP\AppFramework\Services\IInitialState; +use OCP\Authentication\TwoFactorAuth\IRegistry; use OCP\Collaboration\Resources\LoadAdditionalScriptsEvent as ResourcesLoadAdditionalScriptsEvent; use OCP\EventDispatcher\IEventDispatcher; use OCP\Files\Folder; @@ -60,6 +61,7 @@ class ViewController extends Controller { private UserConfig $userConfig, private ViewConfig $viewConfig, private FilenameValidator $filenameValidator, + private IRegistry $twoFactorRegistry, ) { parent::__construct($appName, $request); } @@ -142,7 +144,8 @@ class ViewController extends Controller { Util::addInitScript('files', 'init'); Util::addScript('files', 'main'); - $userId = $this->userSession->getUser()->getUID(); + $user = $this->userSession->getUser(); + $userId = $user->getUID(); // If the file doesn't exists in the folder and // exists in only one occurrence, redirect to that file @@ -195,6 +198,15 @@ class ViewController extends Controller { $this->initialState->provideInitialState('templates_path', $this->templateManager->hasTemplateDirectory() ? $this->templateManager->getTemplatePath() : false); $this->initialState->provideInitialState('templates', $this->templateManager->listCreators()); + $isTwoFactorEnabled = false; + foreach ($this->twoFactorRegistry->getProviderStates($user) as $providerId => $providerState) { + if ($providerId !== 'backup_codes' && $providerState === true) { + $isTwoFactorEnabled = true; + } + } + + $this->initialState->provideInitialState('isTwoFactorEnabled', $isTwoFactorEnabled); + $response = new TemplateResponse( Application::APP_ID, 'index', diff --git a/apps/files/lib/Service/UserConfig.php b/apps/files/lib/Service/UserConfig.php index 4dae198ee55..dcf30b7796d 100644 --- a/apps/files/lib/Service/UserConfig.php +++ b/apps/files/lib/Service/UserConfig.php @@ -50,6 +50,12 @@ class UserConfig { 'allowed' => [true, false], ], [ + // Whether to show the files extensions in the files list or not + 'key' => 'show_files_extensions', + 'default' => true, + 'allowed' => [true, false], + ], + [ // Whether to show the hidden files or not in the files list 'key' => 'show_hidden', 'default' => false, |