diff options
Diffstat (limited to 'lib/private/Settings')
-rw-r--r-- | lib/private/Settings/Manager.php | 2 | ||||
-rw-r--r-- | lib/private/Settings/Personal/PersonalInfo.php | 1 | ||||
-rw-r--r-- | lib/private/Settings/Personal/Security.php | 19 |
3 files changed, 19 insertions, 3 deletions
diff --git a/lib/private/Settings/Manager.php b/lib/private/Settings/Manager.php index 7040f87261f..82cb223bb9f 100644 --- a/lib/private/Settings/Manager.php +++ b/lib/private/Settings/Manager.php @@ -308,7 +308,7 @@ class Manager implements IManager { } if($section === 'security') { /** @var ISettings $form */ - $form = new Personal\Security(); + $form = new Personal\Security($this->userManager); $forms[$form->getPriority()] = [$form]; } if ($section === 'additional') { diff --git a/lib/private/Settings/Personal/PersonalInfo.php b/lib/private/Settings/Personal/PersonalInfo.php index f4a8548e8f1..8c1c8cb19b8 100644 --- a/lib/private/Settings/Personal/PersonalInfo.php +++ b/lib/private/Settings/Personal/PersonalInfo.php @@ -135,7 +135,6 @@ class PersonalInfo implements ISettings { 'twitterScope' => $userData[AccountManager::PROPERTY_TWITTER]['scope'], 'twitterVerification' => $userData[AccountManager::PROPERTY_TWITTER]['verified'], 'groups' => $this->getGroups($user), - 'passwordChangeSupported' => $user->canChangePassword(), ] + $messageParameters + $languageParameters + $localeParameters; diff --git a/lib/private/Settings/Personal/Security.php b/lib/private/Settings/Personal/Security.php index ecbd1199d11..efcfd5589ce 100644 --- a/lib/private/Settings/Personal/Security.php +++ b/lib/private/Settings/Personal/Security.php @@ -25,16 +25,33 @@ namespace OC\Settings\Personal; use OCP\AppFramework\Http\TemplateResponse; +use OCP\IUserManager; use OCP\Settings\ISettings; class Security implements ISettings { + private $userManager; + + public function __construct( + IUserManager $userManager + ) { + $this->userManager = $userManager; + } + /** * @return TemplateResponse returns the instance with all parameters set, ready to be rendered * @since 9.1 */ public function getForm() { - return new TemplateResponse('settings', 'settings/personal/security'); + $user = $this->userManager->get(\OC_User::getUser()); + $passwordChangeSupported = false; + if ($user !== null) { + $passwordChangeSupported = $user->canChangePassword(); + } + + return new TemplateResponse('settings', 'settings/personal/security', [ + 'passwordChangeSupported' => $passwordChangeSupported + ]); } /** |