diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2018-10-02 19:10:11 +0300 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2018-10-02 19:10:11 +0300 |
commit | a3199653980741e2c08e1e5477346fc443e28ebe (patch) | |
tree | a5ab8ec4b6c15b51048315d5f9405d8a20c2c982 /lib | |
parent | 5eb46ca8b0570545e305ce7b859ceb5004e8a231 (diff) |
Update to new 2FA settings API
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Provider/TotpProvider.php | 11 | ||||
-rw-r--r-- | lib/Settings/Personal.php | 36 |
2 files changed, 18 insertions, 29 deletions
diff --git a/lib/Provider/TotpProvider.php b/lib/Provider/TotpProvider.php index 6ae155b..bffa94b 100644 --- a/lib/Provider/TotpProvider.php +++ b/lib/Provider/TotpProvider.php @@ -1,6 +1,6 @@ <?php -declare(strict_types = 1); +declare(strict_types=1); /** * @author Christoph Wurst <christoph@winzerhof-wurst.at> @@ -24,13 +24,16 @@ declare(strict_types = 1); namespace OCA\TwoFactorTOTP\Provider; use OCA\TwoFactorTOTP\Service\ITotp; +use OCA\TwoFactorTOTP\Settings\Personal; +use OCP\Authentication\TwoFactorAuth\IPersonalProviderSettings; use OCP\Authentication\TwoFactorAuth\IProvider; use OCP\Authentication\TwoFactorAuth\IProvidesIcons; +use OCP\Authentication\TwoFactorAuth\IProvidesPersonalSettings; use OCP\IL10N; use OCP\IUser; use OCP\Template; -class TotpProvider implements IProvider, IProvidesIcons { +class TotpProvider implements IProvider, IProvidesIcons, IProvidesPersonalSettings { /** @var ITotp */ private $totp; @@ -94,4 +97,8 @@ class TotpProvider implements IProvider, IProvidesIcons { public function getDarkIcon(): String { return image_path('twofactor_totp', 'app-dark.svg'); } + + public function getPersonalSettings(IUser $user): IPersonalProviderSettings { + return new Personal(); + } } diff --git a/lib/Settings/Personal.php b/lib/Settings/Personal.php index 041bacf..550d8ff 100644 --- a/lib/Settings/Personal.php +++ b/lib/Settings/Personal.php @@ -1,4 +1,7 @@ <?php + +declare(strict_types=1); + /** * @author Christoph Wurst <christoph@winzerhof-wurst.at> * @@ -17,36 +20,15 @@ * along with this program. If not, see <http://www.gnu.org/licenses/> * */ -namespace OCA\TwoFactorTOTP\Settings; - -use OCP\AppFramework\Http\TemplateResponse; -use OCP\Settings\ISettings; -class Personal implements ISettings { +namespace OCA\TwoFactorTOTP\Settings; - /** - * @return TemplateResponse - */ - public function getForm() { - return new TemplateResponse('twofactor_totp', 'personal'); - } +use OCP\Authentication\TwoFactorAuth\IPersonalProviderSettings; +use OCP\Template; - /** - * @return string the section ID, e.g. 'sharing' - */ - public function getSection() { - return 'security'; - } +class Personal implements IPersonalProviderSettings { - /** - * @return int whether the form should be rather on the top or bottom of - * the admin section. The forms are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. - * - * E.g.: 70 - */ - public function getPriority() { - return 40; + public function getBody(): Template { + return new Template('twofactor_totp', 'personal'); } - } |