From 60c42914d8d4ef815b239cb3b83ee682e56c5c22 Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Tue, 2 Aug 2022 02:03:19 +0200 Subject: Port password settings to vue Signed-off-by: Carl Schwan --- .../lib/Controller/ChangePasswordController.php | 26 ++---- apps/settings/src/components/PasswordSection.vue | 98 ++++++++++++++++++++++ apps/settings/src/main-personal-password.js | 36 ++++++++ .../settings/personal/security/password.php | 43 +--------- 4 files changed, 144 insertions(+), 59 deletions(-) create mode 100644 apps/settings/src/components/PasswordSection.vue create mode 100644 apps/settings/src/main-personal-password.js (limited to 'apps') diff --git a/apps/settings/lib/Controller/ChangePasswordController.php b/apps/settings/lib/Controller/ChangePasswordController.php index 41f2584721c..a25f0b0e59b 100644 --- a/apps/settings/lib/Controller/ChangePasswordController.php +++ b/apps/settings/lib/Controller/ChangePasswordController.php @@ -49,28 +49,16 @@ use OCP\IUserManager; use OCP\IUserSession; class ChangePasswordController extends Controller { - - /** @var string */ - private $userId; - - /** @var IUserManager */ - private $userManager; - - /** @var IL10N */ - private $l; - - /** @var GroupManager */ - private $groupManager; - - /** @var Session */ - private $userSession; - - /** @var IAppManager */ - private $appManager; + private ?string $userId; + private IUserManager $userManager; + private IL10N $l; + private GroupManager $groupManager; + private Session $userSession; + private IAppManager $appManager; public function __construct(string $appName, IRequest $request, - string $userId, + ?string $userId, IUserManager $userManager, IUserSession $userSession, IGroupManager $groupManager, diff --git a/apps/settings/src/components/PasswordSection.vue b/apps/settings/src/components/PasswordSection.vue new file mode 100644 index 00000000000..b68de0365e0 --- /dev/null +++ b/apps/settings/src/components/PasswordSection.vue @@ -0,0 +1,98 @@ + + + + + + diff --git a/apps/settings/src/main-personal-password.js b/apps/settings/src/main-personal-password.js new file mode 100644 index 00000000000..cd27832a7df --- /dev/null +++ b/apps/settings/src/main-personal-password.js @@ -0,0 +1,36 @@ +/** + * @copyright 2022 Carl Schwan + * + * @license AGPL-3.0-or-later + * + * 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 . + * + */ + +import Vue from 'vue' + +import PasswordSection from './components/PasswordSection.vue' +import { translate as t, translatePlural as n } from '@nextcloud/l10n' + +// eslint-disable-next-line camelcase +__webpack_nonce__ = btoa(OC.requestToken) + +Vue.prototype.t = t +Vue.prototype.n = n + +export default new Vue({ + el: '#security-password', + name: 'main-personal-password', + render: h => h(PasswordSection), +}) diff --git a/apps/settings/templates/settings/personal/security/password.php b/apps/settings/templates/settings/personal/security/password.php index f44d95c0997..bc363b15aa7 100644 --- a/apps/settings/templates/settings/personal/security/password.php +++ b/apps/settings/templates/settings/personal/security/password.php @@ -1,6 +1,7 @@ + * @copyright Copyright (c) 2022 Carl Schwan * * @author Arthur Schiwon * @@ -21,46 +22,8 @@ * */ -script('settings', [ - 'settings', - 'templates', - 'vue-settings-personal-security', -]); - if ($_['passwordChangeSupported']) { - script('settings', 'security_password'); + \OCP\Util::addScript('settings', 'vue-settings-personal-password'); } - ?> - -
-

t('Password'));?>

- -
-
-
- - -
- -
- - - - -
- -
- -
-
-
- -
- +
-- cgit v1.2.3