Move password settings

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
Roeland Jago Douma 2020-01-30 13:24:10 +01:00
parent 9ed106f69a
commit dc1979903e
No known key found for this signature in database
GPG key ID: F941078878347C0C
8 changed files with 15 additions and 18 deletions

View file

@ -38,8 +38,8 @@ return array(
'OCA\\Settings\\Middleware\\SubadminMiddleware' => $baseDir . '/../lib/Middleware/SubadminMiddleware.php', 'OCA\\Settings\\Middleware\\SubadminMiddleware' => $baseDir . '/../lib/Middleware/SubadminMiddleware.php',
'OCA\\Settings\\Personal\\Additional' => $baseDir . '/../lib/Settings/Personal/Additional.php', 'OCA\\Settings\\Personal\\Additional' => $baseDir . '/../lib/Settings/Personal/Additional.php',
'OCA\\Settings\\Personal\\PersonalInfo' => $baseDir . '/../lib/Settings/Personal/PersonalInfo.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\\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\\Personal\\ServerDevNotice' => $baseDir . '/../lib/Settings/Personal/ServerDevNotice.php',
'OCA\\Settings\\Sections\\Admin\\Additional' => $baseDir . '/../lib/Sections/Admin/Additional.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\\Sections\\Admin\\Groupware' => $baseDir . '/../lib/Sections/Admin/Groupware.php',

View file

@ -53,8 +53,8 @@ class ComposerStaticInitSettings
'OCA\\Settings\\Middleware\\SubadminMiddleware' => __DIR__ . '/..' . '/../lib/Middleware/SubadminMiddleware.php', 'OCA\\Settings\\Middleware\\SubadminMiddleware' => __DIR__ . '/..' . '/../lib/Middleware/SubadminMiddleware.php',
'OCA\\Settings\\Personal\\Additional' => __DIR__ . '/..' . '/../lib/Settings/Personal/Additional.php', 'OCA\\Settings\\Personal\\Additional' => __DIR__ . '/..' . '/../lib/Settings/Personal/Additional.php',
'OCA\\Settings\\Personal\\PersonalInfo' => __DIR__ . '/..' . '/../lib/Settings/Personal/PersonalInfo.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\\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\\Personal\\ServerDevNotice' => __DIR__ . '/..' . '/../lib/Settings/Personal/ServerDevNotice.php',
'OCA\\Settings\\Sections\\Admin\\Additional' => __DIR__ . '/..' . '/../lib/Sections/Admin/Additional.php', 'OCA\\Settings\\Sections\\Admin\\Additional' => __DIR__ . '/..' . '/../lib/Sections/Admin/Additional.php',
'OCA\\Settings\\Sections\\Admin\\Groupware' => __DIR__ . '/..' . '/../lib/Sections/Admin/Groupware.php', 'OCA\\Settings\\Sections\\Admin\\Groupware' => __DIR__ . '/..' . '/../lib/Sections/Admin/Groupware.php',

View file

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1);
/** /**
* @copyright Copyright (c) 2017 Arthur Schiwon <blizzz@arthur-schiwon.de> * @copyright Copyright (c) 2017 Arthur Schiwon <blizzz@arthur-schiwon.de>
* *
@ -25,13 +26,13 @@
* *
*/ */
namespace OCA\Settings\Personal; namespace OCA\Settings\Personal\Security;
use OCP\AppFramework\Http\TemplateResponse; use OCP\AppFramework\Http\TemplateResponse;
use OCP\IUserManager; use OCP\IUserManager;
use OCP\Settings\ISettings; use OCP\Settings\ISettings;
class Security implements ISettings { class Password implements ISettings {
/** @var IUserManager */ /** @var IUserManager */
private $userManager; private $userManager;
@ -52,7 +53,7 @@ class Security implements ISettings {
$passwordChangeSupported = $user->canChangePassword(); $passwordChangeSupported = $user->canChangePassword();
} }
return new TemplateResponse('settings', 'settings/personal/security', [ return new TemplateResponse('settings', 'settings/personal/security/password', [
'passwordChangeSupported' => $passwordChangeSupported, 'passwordChangeSupported' => $passwordChangeSupported,
]); ]);
} }

View file

@ -29,7 +29,7 @@ namespace OCA\Settings\Tests\Settings\Personal\Security;
use OC\Authentication\Token\DefaultToken; use OC\Authentication\Token\DefaultToken;
use OC\Authentication\Token\IProvider as IAuthTokenProvider; use OC\Authentication\Token\IProvider as IAuthTokenProvider;
use OCA\Settings\Personal\Security; use OCA\Settings\Personal\Password;
use OCA\Settings\Personal\Security\Authtokens; use OCA\Settings\Personal\Security\Authtokens;
use OCP\AppFramework\Http\TemplateResponse; use OCP\AppFramework\Http\TemplateResponse;
use OCP\IInitialStateService; use OCP\IInitialStateService;

View file

@ -1,5 +1,4 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
/** /**
@ -28,17 +27,14 @@ declare(strict_types=1);
namespace OCA\Settings\Tests\Settings\Personal; namespace OCA\Settings\Tests\Settings\Personal;
use OC\Authentication\TwoFactorAuth\ProviderLoader; use OCA\Settings\Personal\Security\Password;
use OCA\Settings\Personal\Security;
use OCP\AppFramework\Http\TemplateResponse; use OCP\AppFramework\Http\TemplateResponse;
use OCP\IConfig;
use OCP\IUser; use OCP\IUser;
use OCP\IUserManager; use OCP\IUserManager;
use OCP\IUserSession;
use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase; use Test\TestCase;
class SecurityTest extends TestCase { class PasswordTest extends TestCase {
/** @var IUserManager|MockObject */ /** @var IUserManager|MockObject */
private $userManager; private $userManager;
@ -46,7 +42,7 @@ class SecurityTest extends TestCase {
/** @var string */ /** @var string */
private $uid; private $uid;
/** @var Security */ /** @var Password */
private $section; private $section;
protected function setUp(): void { protected function setUp(): void {
@ -55,7 +51,7 @@ class SecurityTest extends TestCase {
$this->userManager = $this->createMock(IUserManager::class); $this->userManager = $this->createMock(IUserManager::class);
$this->uid = 'test123'; $this->uid = 'test123';
$this->section = new Security( $this->section = new Password(
$this->userManager, $this->userManager,
$this->uid $this->uid
); );

View file

@ -289,7 +289,7 @@ class Manager implements IManager {
} }
if ($section === 'security') { if ($section === 'security') {
/** @var ISettings $form */ /** @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]; $forms[$form->getPriority()] = [$form];
/** @var ISettings $form */ /** @var ISettings $form */

View file

@ -26,7 +26,7 @@ namespace OCA\Settings\Tests\AppInfo;
use OC\Settings\Manager; use OC\Settings\Manager;
use OC\Settings\Section; use OC\Settings\Section;
use OCA\Settings\Admin\Sharing; use OCA\Settings\Admin\Sharing;
use OCA\Settings\Personal\Security; use OCA\Settings\Personal\Password;
use OCP\IDBConnection; use OCP\IDBConnection;
use OCP\IL10N; use OCP\IL10N;
use OCP\ILogger; use OCP\ILogger;
@ -149,7 +149,7 @@ class ManagerTest extends TestCase {
} }
public function testGetPersonalSettings() { public function testGetPersonalSettings() {
$section = $this->createMock(Security::class); $section = $this->createMock(Password::class);
$section->expects($this->once()) $section->expects($this->once())
->method('getPriority') ->method('getPriority')
->willReturn(16); ->willReturn(16);
@ -159,7 +159,7 @@ class ManagerTest extends TestCase {
->willReturn(100); ->willReturn(100);
$this->container->expects($this->at(0)) $this->container->expects($this->at(0))
->method('query') ->method('query')
->with(Security::class) ->with(Password::class)
->willReturn($section); ->willReturn($section);
$this->container->expects($this->at(1)) $this->container->expects($this->at(1))
->method('query') ->method('query')