diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2020-01-29 10:42:11 +0100 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2020-01-29 20:37:47 +0100 |
commit | 391a368557b18a89c79406d366e578530e36fe36 (patch) | |
tree | dbfdb1fa9c74838a7f91e47079c2160a948bd8ca /apps/settings/templates | |
parent | 53817f5fc20533d2b9da2ecff6bd96acf21b4e17 (diff) | |
download | nextcloud-server-391a368557b18a89c79406d366e578530e36fe36.tar.gz nextcloud-server-391a368557b18a89c79406d366e578530e36fe36.zip |
Move the personal 2FA settings to its own app
Small isolated classes are easier to understand and to maintain!
Another step in the cleaning up of the settings. So that adding new
stuff later is easier.
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps/settings/templates')
-rw-r--r-- | apps/settings/templates/settings/personal/security.php | 45 | ||||
-rw-r--r-- | apps/settings/templates/settings/personal/security/twofactor.php | 70 |
2 files changed, 70 insertions, 45 deletions
diff --git a/apps/settings/templates/settings/personal/security.php b/apps/settings/templates/settings/personal/security.php index e72b443f59b..23959f7d9c2 100644 --- a/apps/settings/templates/settings/personal/security.php +++ b/apps/settings/templates/settings/personal/security.php @@ -59,48 +59,3 @@ if($_['passwordChangeSupported']) { <span class="msg"></span> </div> <?php } ?> - -<div id="two-factor-auth" class="section"> - <h2><?php p($l->t('Two-Factor Authentication'));?></h2> - <a target="_blank" rel="noreferrer noopener" class="icon-info" - title="<?php p($l->t('Open documentation'));?>" - href="<?php p(link_to_docs('user-2fa')); ?>"></a> - <p class="settings-hint"><?php p($l->t('Use a second factor besides your password to increase security for your account.'));?></p> - <ul> - <?php foreach ($_['twoFactorProviderData']['providers'] as $data) { ?> - <li> - <?php - - /** @var \OCP\Authentication\TwoFactorAuth\IProvidesPersonalSettings $provider */ - $provider = $data['provider']; - //Handle 2FA provider icons and theme - if ($provider instanceof \OCP\Authentication\TwoFactorAuth\IProvidesIcons) { - if ($_['themedark']) { - $icon = $provider->getLightIcon(); - } - else { - $icon = $provider->getDarkIcon(); - } - //fallback icon if the 2factor provider doesn't provide an icon. - } else { - if ($_['themedark']) { - $icon = image_path('core', 'actions/password-white.svg'); - } - else { - $icon = image_path('core', 'actions/password.svg'); - } - - } - /** @var \OCP\Authentication\TwoFactorAuth\IPersonalProviderSettings $settings */ - $settings = $data['settings']; - ?> - <h3> - <img class="two-factor-provider-settings-icon" src="<?php p($icon) ?>" alt=""> - <?php p($provider->getDisplayName()) ?> - </h3> - <?php print_unescaped($settings->getBody()->fetchPage()) ?> - </li> - <?php } ?> - </ul> -</div> - diff --git a/apps/settings/templates/settings/personal/security/twofactor.php b/apps/settings/templates/settings/personal/security/twofactor.php new file mode 100644 index 00000000000..f5e5b7025c2 --- /dev/null +++ b/apps/settings/templates/settings/personal/security/twofactor.php @@ -0,0 +1,70 @@ +<?php +declare(strict_types=1); +/** + * @copyright Copyright (c) 2020, Roeland Jago Douma <roeland@famdouma.nl> + * + * @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/>. + * + */ + +?> + +<div id="two-factor-auth" class="section"> + <h2><?php p($l->t('Two-Factor Authentication'));?></h2> + <a target="_blank" rel="noreferrer noopener" class="icon-info" + title="<?php p($l->t('Open documentation'));?>" + href="<?php p(link_to_docs('user-2fa')); ?>"></a> + <p class="settings-hint"><?php p($l->t('Use a second factor besides your password to increase security for your account.'));?></p> + <ul> + <?php foreach ($_['twoFactorProviderData']['providers'] as $data) { ?> + <li> + <?php + + /** @var \OCP\Authentication\TwoFactorAuth\IProvidesPersonalSettings $provider */ + $provider = $data['provider']; + //Handle 2FA provider icons and theme + if ($provider instanceof \OCP\Authentication\TwoFactorAuth\IProvidesIcons) { + if ($_['themedark']) { + $icon = $provider->getLightIcon(); + } + else { + $icon = $provider->getDarkIcon(); + } + //fallback icon if the 2factor provider doesn't provide an icon. + } else { + if ($_['themedark']) { + $icon = image_path('core', 'actions/password-white.svg'); + } + else { + $icon = image_path('core', 'actions/password.svg'); + } + + } + /** @var \OCP\Authentication\TwoFactorAuth\IPersonalProviderSettings $settings */ + $settings = $data['settings']; + ?> + <h3> + <img class="two-factor-provider-settings-icon" src="<?php p($icon) ?>" alt=""> + <?php p($provider->getDisplayName()) ?> + </h3> + <?php print_unescaped($settings->getBody()->fetchPage()) ?> + </li> + <?php } ?> + </ul> +</div> + |