diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2018-11-02 12:32:45 +0100 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2018-11-02 13:44:45 +0100 |
commit | 60bcae55a9ea9e6b474b790ff291c04fc54c810b (patch) | |
tree | 8ee1974a8d05c86465acfed63fbaad53a8612c0e /lib/private/Template | |
parent | 603b672a113a33aef2e230f2720734078d702ff6 (diff) | |
download | nextcloud-server-60bcae55a9ea9e6b474b790ff291c04fc54c810b.tar.gz nextcloud-server-60bcae55a9ea9e6b474b790ff291c04fc54c810b.zip |
Expose the info to the JS
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib/private/Template')
-rw-r--r-- | lib/private/Template/JSConfigHelper.php | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/private/Template/JSConfigHelper.php b/lib/private/Template/JSConfigHelper.php index ad9ff0b6757..26da8fcc3c9 100644 --- a/lib/private/Template/JSConfigHelper.php +++ b/lib/private/Template/JSConfigHelper.php @@ -37,6 +37,7 @@ use OCP\IL10N; use OCP\ISession; use OCP\IURLGenerator; use OCP\IUser; +use OCP\User\Backend\IPasswordConfirmationBackend; class JSConfigHelper { @@ -109,12 +110,18 @@ class JSConfigHelper { public function getConfig() { + $userBackendAllowsPasswordConfirmation = true; if ($this->currentUser !== null) { $uid = $this->currentUser->getUID(); - $userBackend = $this->currentUser->getBackendClassName(); + + $backend = $this->currentUser->getBackend(); + if ($backend instanceof IPasswordConfirmationBackend) { + $userBackendAllowsPasswordConfirmation = $backend->canConfirmPassword($uid); + } else if (isset($this->excludedUserBackEnds[$this->currentUser->getBackendClassName()])) { + $userBackendAllowsPasswordConfirmation = false; + } } else { $uid = null; - $userBackend = ''; } // Get the config @@ -161,7 +168,7 @@ class JSConfigHelper { $array = [ "oc_debug" => $this->config->getSystemValue('debug', false) ? 'true' : 'false', "oc_isadmin" => $this->groupManager->isAdmin($uid) ? 'true' : 'false', - "backendAllowsPasswordConfirmation" => !isset($this->excludedUserBackEnds[$userBackend]) ? 'true' : 'false', + "backendAllowsPasswordConfirmation" => $userBackendAllowsPasswordConfirmation ? 'true' : 'false', "oc_dataURL" => is_string($dataLocation) ? "\"".$dataLocation."\"" : 'false', "oc_webroot" => "\"".\OC::$WEBROOT."\"", "oc_appswebroots" => str_replace('\\/', '/', json_encode($apps_paths)), // Ugly unescape slashes waiting for better solution |