'OCA\\Settings\\Middleware\\SubadminMiddleware' => $baseDir . '/../lib/Middleware/SubadminMiddleware.php',
'OCA\\Settings\\Personal\\Additional' => $baseDir . '/../lib/Settings/Personal/Additional.php',
'OCA\\Settings\\Personal\\PersonalInfo' => $baseDir . '/../lib/Settings/Personal/PersonalInfo.php',
- 'OCA\\Settings\\Personal\\Security' => $baseDir . '/../lib/Settings/Personal/Security.php',
'OCA\\Settings\\Personal\\Security\\Authtokens' => $baseDir . '/../lib/Settings/Personal/Security/Authtokens.php',
+ 'OCA\\Settings\\Personal\\Security\\Password' => $baseDir . '/../lib/Settings/Personal/Security/Password.php',
'OCA\\Settings\\Personal\\ServerDevNotice' => $baseDir . '/../lib/Settings/Personal/ServerDevNotice.php',
'OCA\\Settings\\Sections\\Admin\\Additional' => $baseDir . '/../lib/Sections/Admin/Additional.php',
'OCA\\Settings\\Sections\\Admin\\Groupware' => $baseDir . '/../lib/Sections/Admin/Groupware.php',
'OCA\\Settings\\Middleware\\SubadminMiddleware' => __DIR__ . '/..' . '/../lib/Middleware/SubadminMiddleware.php',
'OCA\\Settings\\Personal\\Additional' => __DIR__ . '/..' . '/../lib/Settings/Personal/Additional.php',
'OCA\\Settings\\Personal\\PersonalInfo' => __DIR__ . '/..' . '/../lib/Settings/Personal/PersonalInfo.php',
- 'OCA\\Settings\\Personal\\Security' => __DIR__ . '/..' . '/../lib/Settings/Personal/Security.php',
'OCA\\Settings\\Personal\\Security\\Authtokens' => __DIR__ . '/..' . '/../lib/Settings/Personal/Security/Authtokens.php',
+ 'OCA\\Settings\\Personal\\Security\\Password' => __DIR__ . '/..' . '/../lib/Settings/Personal/Security/Password.php',
'OCA\\Settings\\Personal\\ServerDevNotice' => __DIR__ . '/..' . '/../lib/Settings/Personal/ServerDevNotice.php',
'OCA\\Settings\\Sections\\Admin\\Additional' => __DIR__ . '/..' . '/../lib/Sections/Admin/Additional.php',
'OCA\\Settings\\Sections\\Admin\\Groupware' => __DIR__ . '/..' . '/../lib/Sections/Admin/Groupware.php',
+++ /dev/null
-<?php
-/**
- * @copyright Copyright (c) 2017 Arthur Schiwon <blizzz@arthur-schiwon.de>
- *
- * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author Greta Doci <gretadoci@gmail.com>
- * @author Julius Härtl <jus@bitgrid.net>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-namespace OCA\Settings\Personal;
-
-use OCP\AppFramework\Http\TemplateResponse;
-use OCP\IUserManager;
-use OCP\Settings\ISettings;
-
-class Security implements ISettings {
-
- /** @var IUserManager */
- private $userManager;
-
- /** @var string|null */
- private $uid;
-
- public function __construct(IUserManager $userManager,
- ?string $UserId) {
- $this->userManager = $userManager;
- $this->uid = $UserId;
- }
-
- public function getForm(): TemplateResponse {
- $user = $this->userManager->get($this->uid);
- $passwordChangeSupported = false;
- if ($user !== null) {
- $passwordChangeSupported = $user->canChangePassword();
- }
-
- return new TemplateResponse('settings', 'settings/personal/security', [
- 'passwordChangeSupported' => $passwordChangeSupported,
- ]);
- }
-
- public function getSection(): string {
- return 'security';
- }
-
- public function getPriority(): int {
- return 10;
- }
-}
--- /dev/null
+<?php
+declare(strict_types=1);
+/**
+ * @copyright Copyright (c) 2017 Arthur Schiwon <blizzz@arthur-schiwon.de>
+ *
+ * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
+ * @author Christoph Wurst <christoph@winzerhof-wurst.at>
+ * @author Greta Doci <gretadoci@gmail.com>
+ * @author Julius Härtl <jus@bitgrid.net>
+ * @author Roeland Jago Douma <roeland@famdouma.nl>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCA\Settings\Personal\Security;
+
+use OCP\AppFramework\Http\TemplateResponse;
+use OCP\IUserManager;
+use OCP\Settings\ISettings;
+
+class Password implements ISettings {
+
+ /** @var IUserManager */
+ private $userManager;
+
+ /** @var string|null */
+ private $uid;
+
+ public function __construct(IUserManager $userManager,
+ ?string $UserId) {
+ $this->userManager = $userManager;
+ $this->uid = $UserId;
+ }
+
+ public function getForm(): TemplateResponse {
+ $user = $this->userManager->get($this->uid);
+ $passwordChangeSupported = false;
+ if ($user !== null) {
+ $passwordChangeSupported = $user->canChangePassword();
+ }
+
+ return new TemplateResponse('settings', 'settings/personal/security/password', [
+ 'passwordChangeSupported' => $passwordChangeSupported,
+ ]);
+ }
+
+ public function getSection(): string {
+ return 'security';
+ }
+
+ public function getPriority(): int {
+ return 10;
+ }
+}
+++ /dev/null
-<?php
-/**
- * @copyright Copyright (c) 2017 Arthur Schiwon <blizzz@arthur-schiwon.de>
- *
- * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-script('settings', [
- 'settings',
- 'templates',
- 'vue-settings-personal-security',
-]);
-
-if($_['passwordChangeSupported']) {
- script('settings', 'security_password');
-}
-
-?>
-<?php if($_['passwordChangeSupported']) { ?>
-<div id="security-password" class="section">
- <h2 class="inlineblock"><?php p($l->t('Password'));?></h2>
- <span id="password-error-msg" class="msg success hidden">Saved</span>
- <div class="personal-settings-setting-box personal-settings-password-box">
- <form id="passwordform">
- <label for="pass1" class="hidden-visually"><?php p($l->t('Current password')); ?>: </label>
- <input type="password" id="pass1" name="oldpassword"
- placeholder="<?php p($l->t('Current password'));?>"
- autocomplete="off" autocapitalize="none" autocorrect="off" />
-
- <div class="personal-show-container">
- <label for="pass2" class="hidden-visually"><?php p($l->t('New password'));?>: </label>
- <input type="password" id="pass2" name="newpassword"
- placeholder="<?php p($l->t('New password')); ?>"
- data-typetoggle="#personal-show"
- autocomplete="off" autocapitalize="none" autocorrect="off" />
- <input type="checkbox" id="personal-show" class="hidden-visually" name="show" /><label for="personal-show" class="personal-show-label"></label>
- </div>
-
- <input id="passwordbutton" type="submit" value="<?php p($l->t('Change password')); ?>" />
-
- </form>
- </div>
- <span class="msg"></span>
-</div>
-<?php } ?>
--- /dev/null
+<?php
+/**
+ * @copyright Copyright (c) 2017 Arthur Schiwon <blizzz@arthur-schiwon.de>
+ *
+ * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+script('settings', [
+ 'settings',
+ 'templates',
+ 'vue-settings-personal-security',
+]);
+
+if($_['passwordChangeSupported']) {
+ script('settings', 'security_password');
+}
+
+?>
+<?php if($_['passwordChangeSupported']) { ?>
+<div id="security-password" class="section">
+ <h2 class="inlineblock"><?php p($l->t('Password'));?></h2>
+ <span id="password-error-msg" class="msg success hidden">Saved</span>
+ <div class="personal-settings-setting-box personal-settings-password-box">
+ <form id="passwordform">
+ <label for="pass1" class="hidden-visually"><?php p($l->t('Current password')); ?>: </label>
+ <input type="password" id="pass1" name="oldpassword"
+ placeholder="<?php p($l->t('Current password'));?>"
+ autocomplete="off" autocapitalize="none" autocorrect="off" />
+
+ <div class="personal-show-container">
+ <label for="pass2" class="hidden-visually"><?php p($l->t('New password'));?>: </label>
+ <input type="password" id="pass2" name="newpassword"
+ placeholder="<?php p($l->t('New password')); ?>"
+ data-typetoggle="#personal-show"
+ autocomplete="off" autocapitalize="none" autocorrect="off" />
+ <input type="checkbox" id="personal-show" class="hidden-visually" name="show" /><label for="personal-show" class="personal-show-label"></label>
+ </div>
+
+ <input id="passwordbutton" type="submit" value="<?php p($l->t('Change password')); ?>" />
+
+ </form>
+ </div>
+ <span class="msg"></span>
+</div>
+<?php } ?>
use OC\Authentication\Token\DefaultToken;
use OC\Authentication\Token\IProvider as IAuthTokenProvider;
-use OCA\Settings\Personal\Security;
+use OCA\Settings\Personal\Password;
use OCA\Settings\Personal\Security\Authtokens;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\IInitialStateService;
--- /dev/null
+<?php
+declare(strict_types=1);
+
+/**
+ * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
+ *
+ * @author Christoph Wurst <christoph@winzerhof-wurst.at>
+ * @author Greta Doci <gretadoci@gmail.com>
+ * @author Roeland Jago Douma <roeland@famdouma.nl>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCA\Settings\Tests\Settings\Personal;
+
+use OCA\Settings\Personal\Security\Password;
+use OCP\AppFramework\Http\TemplateResponse;
+use OCP\IUser;
+use OCP\IUserManager;
+use PHPUnit\Framework\MockObject\MockObject;
+use Test\TestCase;
+
+class PasswordTest extends TestCase {
+
+ /** @var IUserManager|MockObject */
+ private $userManager;
+
+ /** @var string */
+ private $uid;
+
+ /** @var Password */
+ private $section;
+
+ protected function setUp(): void {
+ parent::setUp();
+
+ $this->userManager = $this->createMock(IUserManager::class);
+ $this->uid = 'test123';
+
+ $this->section = new Password(
+ $this->userManager,
+ $this->uid
+ );
+ }
+
+ public function testGetForm() {
+ $user = $this->createMock(IUser::class);
+ $this->userManager->expects($this->once())
+ ->method('get')
+ ->with($this->uid)
+ ->willReturn($user);
+ $user->expects($this->once())
+ ->method('canChangePassword')
+ ->willReturn(true);
+
+ $form = $this->section->getForm();
+
+ $expected = new TemplateResponse('settings', 'settings/personal/security', [
+ 'passwordChangeSupported' => true,
+ ]);
+ $this->assertEquals($expected, $form);
+ }
+
+}
+++ /dev/null
-<?php
-
-declare(strict_types=1);
-
-/**
- * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
- *
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author Greta Doci <gretadoci@gmail.com>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-namespace OCA\Settings\Tests\Settings\Personal;
-
-use OC\Authentication\TwoFactorAuth\ProviderLoader;
-use OCA\Settings\Personal\Security;
-use OCP\AppFramework\Http\TemplateResponse;
-use OCP\IConfig;
-use OCP\IUser;
-use OCP\IUserManager;
-use OCP\IUserSession;
-use PHPUnit\Framework\MockObject\MockObject;
-use Test\TestCase;
-
-class SecurityTest extends TestCase {
-
- /** @var IUserManager|MockObject */
- private $userManager;
-
- /** @var string */
- private $uid;
-
- /** @var Security */
- private $section;
-
- protected function setUp(): void {
- parent::setUp();
-
- $this->userManager = $this->createMock(IUserManager::class);
- $this->uid = 'test123';
-
- $this->section = new Security(
- $this->userManager,
- $this->uid
- );
- }
-
- public function testGetForm() {
- $user = $this->createMock(IUser::class);
- $this->userManager->expects($this->once())
- ->method('get')
- ->with($this->uid)
- ->willReturn($user);
- $user->expects($this->once())
- ->method('canChangePassword')
- ->willReturn(true);
-
- $form = $this->section->getForm();
-
- $expected = new TemplateResponse('settings', 'settings/personal/security', [
- 'passwordChangeSupported' => true,
- ]);
- $this->assertEquals($expected, $form);
- }
-
-}
}
if ($section === 'security') {
/** @var ISettings $form */
- $form = $this->container->query(\OCA\Settings\Personal\Security::class);
+ $form = $this->container->query(\OCA\Settings\Personal\Security\Password::class);
$forms[$form->getPriority()] = [$form];
/** @var ISettings $form */
use OC\Settings\Manager;
use OC\Settings\Section;
use OCA\Settings\Admin\Sharing;
-use OCA\Settings\Personal\Security;
+use OCA\Settings\Personal\Password;
use OCP\IDBConnection;
use OCP\IL10N;
use OCP\ILogger;
}
public function testGetPersonalSettings() {
- $section = $this->createMock(Security::class);
+ $section = $this->createMock(Password::class);
$section->expects($this->once())
->method('getPriority')
->willReturn(16);
->willReturn(100);
$this->container->expects($this->at(0))
->method('query')
- ->with(Security::class)
+ ->with(Password::class)
->willReturn($section);
$this->container->expects($this->at(1))
->method('query')