]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Security/TwoFactor/Verify.php
Add more 2fa properties
[friendica.git] / src / Module / Security / TwoFactor / Verify.php
index bb3e444a930380c28c5a8c1e32b926bfc8305314..16f146d6dea4cf7d9bdce13807e68bf99b77f15c 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2021, the Friendica project
+ * @copyright Copyright (C) 2010-2022, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -38,7 +38,7 @@ class Verify extends BaseModule
 {
        private static $errors = [];
 
-       public static function post(array $parameters = [])
+       protected function post(array $request = [])
        {
                if (!local_user()) {
                        return;
@@ -71,14 +71,14 @@ class Verify extends BaseModule
                                }
 
                                // Resume normal login workflow
-                               DI::auth()->setForUser($a, User::getById($a->getUserId()), true, true);
+                               DI::auth()->setForUser($a, User::getById($a->getLoggedInUserId()), true, true);
                        } else {
                                self::$errors[] = DI::l10n()->t('Invalid code, please retry.');
                        }
                }
        }
 
-       public static function content(array $parameters = [])
+       protected function content(array $request = []): string
        {
                if (!local_user()) {
                        DI::baseUrl()->redirect();
@@ -96,8 +96,8 @@ class Verify extends BaseModule
                        '$message'          => DI::l10n()->t('<p>Open the two-factor authentication app on your device to get an authentication code and verify your identity.</p>'),
                        '$errors_label'     => DI::l10n()->tt('Error', 'Errors', count(self::$errors)),
                        '$errors'           => self::$errors,
-                       '$recovery_message' => DI::l10n()->t('Don’t have your phone? <a href="%s">Enter a two-factor recovery code</a>', '2fa/recovery'),
-                       '$verify_code'      => ['verify_code', DI::l10n()->t('Please enter a code from your authentication app'), '', '', DI::l10n()->t('Required'), 'autofocus autocomplete="off" placeholder="000000"', 'tel'],
+                       '$recovery_message' => DI::l10n()->t('If you do not have access to your authentication code you can use <a href="%s">a two-factor recovery code</a>.', '2fa/recovery'),
+                       '$verify_code'      => ['verify_code', DI::l10n()->t('Please enter a code from your authentication app'), '', '', DI::l10n()->t('Required'), 'autofocus autocomplete="one-time-code" placeholder="000000" inputmode="numeric" pattern="[0-9]*"', 'tel'],
                        '$trust_browser'    => ['trust_browser', DI::l10n()->t('This is my two-factor authenticator app device'), !empty($_REQUEST['trust_browser'])],
                        '$verify_label'     => DI::l10n()->t('Verify code and complete login'),
                ]);