2017-05-17 07:41:20 -04:00
|
|
|
<?php
|
2020-03-31 04:49:10 -04:00
|
|
|
|
2020-01-30 07:24:10 -05:00
|
|
|
declare(strict_types=1);
|
2020-03-31 04:49:10 -04:00
|
|
|
|
2017-05-17 07:41:20 -04:00
|
|
|
/**
|
2024-06-03 04:23:34 -04:00
|
|
|
* SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
2017-05-17 07:41:20 -04:00
|
|
|
*/
|
2020-01-30 07:30:45 -05:00
|
|
|
namespace OCA\Settings\Settings\Personal\Security;
|
2017-05-17 07:41:20 -04:00
|
|
|
|
|
|
|
|
use OCP\AppFramework\Http\TemplateResponse;
|
2018-06-29 07:01:22 -04:00
|
|
|
use OCP\IUserManager;
|
2017-05-17 07:41:20 -04:00
|
|
|
use OCP\Settings\ISettings;
|
|
|
|
|
|
2020-01-30 07:24:10 -05:00
|
|
|
class Password implements ISettings {
|
2017-05-17 07:41:20 -04:00
|
|
|
|
2024-10-18 06:04:22 -04:00
|
|
|
public function __construct(
|
|
|
|
|
private IUserManager $userManager,
|
2024-10-28 03:14:17 -04:00
|
|
|
private ?string $userId,
|
2024-10-18 06:04:22 -04:00
|
|
|
) {
|
2018-06-29 07:01:22 -04:00
|
|
|
}
|
|
|
|
|
|
2019-09-09 16:12:29 -04:00
|
|
|
public function getForm(): TemplateResponse {
|
2024-10-28 03:14:17 -04:00
|
|
|
$user = $this->userManager->get($this->userId);
|
2018-06-29 07:01:22 -04:00
|
|
|
$passwordChangeSupported = false;
|
|
|
|
|
if ($user !== null) {
|
|
|
|
|
$passwordChangeSupported = $user->canChangePassword();
|
|
|
|
|
}
|
|
|
|
|
|
2020-01-30 07:24:10 -05:00
|
|
|
return new TemplateResponse('settings', 'settings/personal/security/password', [
|
2018-09-26 10:25:18 -04:00
|
|
|
'passwordChangeSupported' => $passwordChangeSupported,
|
2018-06-29 07:01:22 -04:00
|
|
|
]);
|
2017-05-17 07:41:20 -04:00
|
|
|
}
|
|
|
|
|
|
2019-09-09 16:12:29 -04:00
|
|
|
public function getSection(): string {
|
2017-06-16 09:34:16 -04:00
|
|
|
return 'security';
|
2017-05-17 07:41:20 -04:00
|
|
|
}
|
|
|
|
|
|
2019-09-09 16:12:29 -04:00
|
|
|
public function getPriority(): int {
|
2017-05-17 07:41:20 -04:00
|
|
|
return 10;
|
|
|
|
|
}
|
|
|
|
|
}
|