mirror of
https://github.com/friendica/friendica
synced 2025-04-25 21:50:12 +00:00
Revert "Replace Module::init() with Constructors"
This commit is contained in:
parent
0b6e0566d7
commit
89d6c89b67
43 changed files with 921 additions and 1225 deletions
|
@ -21,10 +21,8 @@
|
|||
|
||||
namespace Friendica\Module\Settings\TwoFactor;
|
||||
|
||||
use Friendica\App\BaseURL;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
use Friendica\Security\TwoFactor\Model\AppSpecificPassword;
|
||||
use Friendica\Module\BaseSettings;
|
||||
use Friendica\Module\Security\Login;
|
||||
|
@ -36,33 +34,23 @@ use Friendica\Module\Security\Login;
|
|||
*/
|
||||
class AppSpecific extends BaseSettings
|
||||
{
|
||||
private $appSpecificPassword = null;
|
||||
private static $appSpecificPassword = null;
|
||||
|
||||
/** @var IManagePersonalConfigValues */
|
||||
protected $pConfig;
|
||||
/** @var BaseURL */
|
||||
protected $baseUrl;
|
||||
|
||||
public function __construct(IManagePersonalConfigValues $pConfig, BaseURL $baseUrl, L10n $l10n, array $parameters = [])
|
||||
public function init()
|
||||
{
|
||||
parent::__construct($l10n, $parameters);
|
||||
|
||||
$this->pConfig = $pConfig;
|
||||
$this->baseUrl = $baseUrl;
|
||||
|
||||
if (!local_user()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$verified = $this->pConfig->get(local_user(), '2fa', 'verified');
|
||||
$verified = DI::pConfig()->get(local_user(), '2fa', 'verified');
|
||||
|
||||
if (!$verified) {
|
||||
$this->baseUrl->redirect('settings/2fa');
|
||||
DI::baseUrl()->redirect('settings/2fa');
|
||||
}
|
||||
|
||||
if (!self::checkFormSecurityToken('settings_2fa_password', 't')) {
|
||||
notice($this->t('Please enter your password to access this page.'));
|
||||
$this->baseUrl->redirect('settings/2fa');
|
||||
notice(DI::l10n()->t('Please enter your password to access this page.'));
|
||||
DI::baseUrl()->redirect('settings/2fa');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -79,21 +67,21 @@ class AppSpecific extends BaseSettings
|
|||
case 'generate':
|
||||
$description = $_POST['description'] ?? '';
|
||||
if (empty($description)) {
|
||||
notice($this->t('App-specific password generation failed: The description is empty.'));
|
||||
$this->baseUrl->redirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
notice(DI::l10n()->t('App-specific password generation failed: The description is empty.'));
|
||||
DI::baseUrl()->redirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
} elseif (AppSpecificPassword::checkDuplicateForUser(local_user(), $description)) {
|
||||
notice($this->t('App-specific password generation failed: This description already exists.'));
|
||||
$this->baseUrl->redirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
notice(DI::l10n()->t('App-specific password generation failed: This description already exists.'));
|
||||
DI::baseUrl()->redirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
} else {
|
||||
$this->appSpecificPassword = AppSpecificPassword::generateForUser(local_user(), $_POST['description'] ?? '');
|
||||
info($this->t('New app-specific password generated.'));
|
||||
self::$appSpecificPassword = AppSpecificPassword::generateForUser(local_user(), $_POST['description'] ?? '');
|
||||
info(DI::l10n()->t('New app-specific password generated.'));
|
||||
}
|
||||
|
||||
break;
|
||||
case 'revoke_all' :
|
||||
AppSpecificPassword::deleteAllForUser(local_user());
|
||||
info($this->t('App-specific passwords successfully revoked.'));
|
||||
$this->baseUrl->redirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
info(DI::l10n()->t('App-specific passwords successfully revoked.'));
|
||||
DI::baseUrl()->redirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -102,10 +90,10 @@ class AppSpecific extends BaseSettings
|
|||
self::checkFormSecurityTokenRedirectOnError('settings/2fa/app_specific', 'settings_2fa_app_specific');
|
||||
|
||||
if (AppSpecificPassword::deleteForUser(local_user(), $_POST['revoke_id'])) {
|
||||
info($this->t('App-specific password successfully revoked.'));
|
||||
info(DI::l10n()->t('App-specific password successfully revoked.'));
|
||||
}
|
||||
|
||||
$this->baseUrl->redirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
DI::baseUrl()->redirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -123,22 +111,22 @@ class AppSpecific extends BaseSettings
|
|||
'$form_security_token' => self::getFormSecurityToken('settings_2fa_app_specific'),
|
||||
'$password_security_token' => self::getFormSecurityToken('settings_2fa_password'),
|
||||
|
||||
'$title' => $this->t('Two-factor app-specific passwords'),
|
||||
'$help_label' => $this->t('Help'),
|
||||
'$message' => $this->t('<p>App-specific passwords are randomly generated passwords used instead your regular password to authenticate your account on third-party applications that don\'t support two-factor authentication.</p>'),
|
||||
'$generated_message' => $this->t('Make sure to copy your new app-specific password now. You won’t be able to see it again!'),
|
||||
'$generated_app_specific_password' => $this->appSpecificPassword,
|
||||
'$title' => DI::l10n()->t('Two-factor app-specific passwords'),
|
||||
'$help_label' => DI::l10n()->t('Help'),
|
||||
'$message' => DI::l10n()->t('<p>App-specific passwords are randomly generated passwords used instead your regular password to authenticate your account on third-party applications that don\'t support two-factor authentication.</p>'),
|
||||
'$generated_message' => DI::l10n()->t('Make sure to copy your new app-specific password now. You won’t be able to see it again!'),
|
||||
'$generated_app_specific_password' => self::$appSpecificPassword,
|
||||
|
||||
'$description_label' => $this->t('Description'),
|
||||
'$last_used_label' => $this->t('Last Used'),
|
||||
'$revoke_label' => $this->t('Revoke'),
|
||||
'$revoke_all_label' => $this->t('Revoke All'),
|
||||
'$description_label' => DI::l10n()->t('Description'),
|
||||
'$last_used_label' => DI::l10n()->t('Last Used'),
|
||||
'$revoke_label' => DI::l10n()->t('Revoke'),
|
||||
'$revoke_all_label' => DI::l10n()->t('Revoke All'),
|
||||
|
||||
'$app_specific_passwords' => $appSpecificPasswords,
|
||||
'$generate_message' => $this->t('When you generate a new app-specific password, you must use it right away, it will be shown to you once after you generate it.'),
|
||||
'$generate_title' => $this->t('Generate new app-specific password'),
|
||||
'$description_placeholder_label' => $this->t('Friendiqa on my Fairphone 2...'),
|
||||
'$generate_label' => $this->t('Generate'),
|
||||
'$generate_message' => DI::l10n()->t('When you generate a new app-specific password, you must use it right away, it will be shown to you once after you generate it.'),
|
||||
'$generate_title' => DI::l10n()->t('Generate new app-specific password'),
|
||||
'$description_placeholder_label' => DI::l10n()->t('Friendiqa on my Fairphone 2...'),
|
||||
'$generate_label' => DI::l10n()->t('Generate'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,10 +21,8 @@
|
|||
|
||||
namespace Friendica\Module\Settings\TwoFactor;
|
||||
|
||||
use Friendica\App\BaseURL;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
use Friendica\Security\TwoFactor\Model\RecoveryCode;
|
||||
use Friendica\Module\BaseSettings;
|
||||
use Friendica\Module\Security\Login;
|
||||
|
@ -36,31 +34,21 @@ use Friendica\Module\Security\Login;
|
|||
*/
|
||||
class Recovery extends BaseSettings
|
||||
{
|
||||
/** @var IManagePersonalConfigValues */
|
||||
protected $pConfig;
|
||||
/** @var BaseURL */
|
||||
protected $baseUrl;
|
||||
|
||||
public function __construct(IManagePersonalConfigValues $pConfig, BaseURL $baseUrl, L10n $l10n, array $parameters = [])
|
||||
public function init()
|
||||
{
|
||||
parent::__construct($l10n, $parameters);
|
||||
|
||||
$this->pConfig = $pConfig;
|
||||
$this->baseUrl = $baseUrl;
|
||||
|
||||
if (!local_user()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$secret = $this->pConfig->get(local_user(), '2fa', 'secret');
|
||||
$secret = DI::pConfig()->get(local_user(), '2fa', 'secret');
|
||||
|
||||
if (!$secret) {
|
||||
$this->baseUrl->redirect('settings/2fa');
|
||||
DI::baseUrl()->redirect('settings/2fa');
|
||||
}
|
||||
|
||||
if (!self::checkFormSecurityToken('settings_2fa_password', 't')) {
|
||||
notice($this->t('Please enter your password to access this page.'));
|
||||
$this->baseUrl->redirect('settings/2fa');
|
||||
notice(DI::l10n()->t('Please enter your password to access this page.'));
|
||||
DI::baseUrl()->redirect('settings/2fa');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,8 +63,8 @@ class Recovery extends BaseSettings
|
|||
|
||||
if ($_POST['action'] == 'regenerate') {
|
||||
RecoveryCode::regenerateForUser(local_user());
|
||||
info($this->t('New recovery codes successfully generated.'));
|
||||
$this->baseUrl->redirect('settings/2fa/recovery?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
info(DI::l10n()->t('New recovery codes successfully generated.'));
|
||||
DI::baseUrl()->redirect('settings/2fa/recovery?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -95,20 +83,20 @@ class Recovery extends BaseSettings
|
|||
|
||||
$recoveryCodes = RecoveryCode::getListForUser(local_user());
|
||||
|
||||
$verified = $this->pConfig->get(local_user(), '2fa', 'verified');
|
||||
$verified = DI::pConfig()->get(local_user(), '2fa', 'verified');
|
||||
|
||||
return Renderer::replaceMacros(Renderer::getMarkupTemplate('settings/twofactor/recovery.tpl'), [
|
||||
'$form_security_token' => self::getFormSecurityToken('settings_2fa_recovery'),
|
||||
'$password_security_token' => self::getFormSecurityToken('settings_2fa_password'),
|
||||
|
||||
'$title' => $this->t('Two-factor recovery codes'),
|
||||
'$help_label' => $this->t('Help'),
|
||||
'$message' => $this->t('<p>Recovery codes can be used to access your account in the event you lose access to your device and cannot receive two-factor authentication codes.</p><p><strong>Put these in a safe spot!</strong> If you lose your device and don’t have the recovery codes you will lose access to your account.</p>'),
|
||||
'$title' => DI::l10n()->t('Two-factor recovery codes'),
|
||||
'$help_label' => DI::l10n()->t('Help'),
|
||||
'$message' => DI::l10n()->t('<p>Recovery codes can be used to access your account in the event you lose access to your device and cannot receive two-factor authentication codes.</p><p><strong>Put these in a safe spot!</strong> If you lose your device and don’t have the recovery codes you will lose access to your account.</p>'),
|
||||
'$recovery_codes' => $recoveryCodes,
|
||||
'$regenerate_message' => $this->t('When you generate new recovery codes, you must copy the new codes. Your old codes won’t work anymore.'),
|
||||
'$regenerate_label' => $this->t('Generate new recovery codes'),
|
||||
'$regenerate_message' => DI::l10n()->t('When you generate new recovery codes, you must copy the new codes. Your old codes won’t work anymore.'),
|
||||
'$regenerate_label' => DI::l10n()->t('Generate new recovery codes'),
|
||||
'$verified' => $verified,
|
||||
'$verify_label' => $this->t('Next: Verification'),
|
||||
'$verify_label' => DI::l10n()->t('Next: Verification'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,10 +2,8 @@
|
|||
|
||||
namespace Friendica\Module\Settings\TwoFactor;
|
||||
|
||||
use Friendica\App\BaseURL;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
use Friendica\Module\BaseSettings;
|
||||
use Friendica\Security\TwoFactor;
|
||||
use Friendica\Util\Temporal;
|
||||
|
@ -16,34 +14,21 @@ use UAParser\Parser;
|
|||
*/
|
||||
class Trusted extends BaseSettings
|
||||
{
|
||||
/** @var IManagePersonalConfigValues */
|
||||
protected $pConfig;
|
||||
/** @var BaseURL */
|
||||
protected $baseUrl;
|
||||
/** @var TwoFactor\Repository\TrustedBrowser */
|
||||
protected $trustedBrowserRepo;
|
||||
|
||||
public function __construct(IManagePersonalConfigValues $pConfig, BaseURL $baseUrl, TwoFactor\Repository\TrustedBrowser $trustedBrowserRepo, L10n $l10n, array $parameters = [])
|
||||
public function init()
|
||||
{
|
||||
parent::__construct($l10n, $parameters);
|
||||
|
||||
$this->pConfig = $pConfig;
|
||||
$this->baseUrl = $baseUrl;
|
||||
$this->trustedBrowserRepo = $trustedBrowserRepo;
|
||||
|
||||
if (!local_user()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$verified = $this->pConfig->get(local_user(), '2fa', 'verified');
|
||||
$verified = DI::pConfig()->get(local_user(), '2fa', 'verified');
|
||||
|
||||
if (!$verified) {
|
||||
$this->baseUrl->redirect('settings/2fa');
|
||||
DI::baseUrl()->redirect('settings/2fa');
|
||||
}
|
||||
|
||||
if (!self::checkFormSecurityToken('settings_2fa_password', 't')) {
|
||||
notice($this->t('Please enter your password to access this page.'));
|
||||
$this->baseUrl->redirect('settings/2fa');
|
||||
notice(DI::l10n()->t('Please enter your password to access this page.'));
|
||||
DI::baseUrl()->redirect('settings/2fa');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -53,14 +38,16 @@ class Trusted extends BaseSettings
|
|||
return;
|
||||
}
|
||||
|
||||
$trustedBrowserRepository = new TwoFactor\Repository\TrustedBrowser(DI::dba(), DI::logger());
|
||||
|
||||
if (!empty($_POST['action'])) {
|
||||
self::checkFormSecurityTokenRedirectOnError('settings/2fa/trusted', 'settings_2fa_trusted');
|
||||
|
||||
switch ($_POST['action']) {
|
||||
case 'remove_all' :
|
||||
$this->trustedBrowserRepo->removeAllForUser(local_user());
|
||||
info($this->t('Trusted browsers successfully removed.'));
|
||||
$this->baseUrl->redirect('settings/2fa/trusted?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
$trustedBrowserRepository->removeAllForUser(local_user());
|
||||
info(DI::l10n()->t('Trusted browsers successfully removed.'));
|
||||
DI::baseUrl()->redirect('settings/2fa/trusted?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -68,11 +55,11 @@ class Trusted extends BaseSettings
|
|||
if (!empty($_POST['remove_id'])) {
|
||||
self::checkFormSecurityTokenRedirectOnError('settings/2fa/trusted', 'settings_2fa_trusted');
|
||||
|
||||
if ($this->trustedBrowserRepo->removeForUser(local_user(), $_POST['remove_id'])) {
|
||||
info($this->t('Trusted browser successfully removed.'));
|
||||
if ($trustedBrowserRepository->removeForUser(local_user(), $_POST['remove_id'])) {
|
||||
info(DI::l10n()->t('Trusted browser successfully removed.'));
|
||||
}
|
||||
|
||||
$this->baseUrl->redirect('settings/2fa/trusted?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
DI::baseUrl()->redirect('settings/2fa/trusted?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -81,7 +68,8 @@ class Trusted extends BaseSettings
|
|||
{
|
||||
parent::content();
|
||||
|
||||
$trustedBrowsers = $this->trustedBrowserRepo->selectAllByUid(local_user());
|
||||
$trustedBrowserRepository = new TwoFactor\Repository\TrustedBrowser(DI::dba(), DI::logger());
|
||||
$trustedBrowsers = $trustedBrowserRepository->selectAllByUid(local_user());
|
||||
|
||||
$parser = Parser::create();
|
||||
|
||||
|
@ -106,15 +94,15 @@ class Trusted extends BaseSettings
|
|||
'$form_security_token' => self::getFormSecurityToken('settings_2fa_trusted'),
|
||||
'$password_security_token' => self::getFormSecurityToken('settings_2fa_password'),
|
||||
|
||||
'$title' => $this->t('Two-factor Trusted Browsers'),
|
||||
'$message' => $this->t('Trusted browsers are individual browsers you chose to skip two-factor authentication to access Friendica. Please use this feature sparingly, as it can negate the benefit of two-factor authentication.'),
|
||||
'$device_label' => $this->t('Device'),
|
||||
'$os_label' => $this->t('OS'),
|
||||
'$browser_label' => $this->t('Browser'),
|
||||
'$created_label' => $this->t('Trusted'),
|
||||
'$last_used_label' => $this->t('Last Use'),
|
||||
'$remove_label' => $this->t('Remove'),
|
||||
'$remove_all_label' => $this->t('Remove All'),
|
||||
'$title' => DI::l10n()->t('Two-factor Trusted Browsers'),
|
||||
'$message' => DI::l10n()->t('Trusted browsers are individual browsers you chose to skip two-factor authentication to access Friendica. Please use this feature sparingly, as it can negate the benefit of two-factor authentication.'),
|
||||
'$device_label' => DI::l10n()->t('Device'),
|
||||
'$os_label' => DI::l10n()->t('OS'),
|
||||
'$browser_label' => DI::l10n()->t('Browser'),
|
||||
'$created_label' => DI::l10n()->t('Trusted'),
|
||||
'$last_used_label' => DI::l10n()->t('Last Use'),
|
||||
'$remove_label' => DI::l10n()->t('Remove'),
|
||||
'$remove_all_label' => DI::l10n()->t('Remove All'),
|
||||
|
||||
'$trusted_browsers' => $trustedBrowserDisplay,
|
||||
]);
|
||||
|
|
|
@ -25,11 +25,9 @@ use BaconQrCode\Renderer\Image\SvgImageBackEnd;
|
|||
use BaconQrCode\Renderer\ImageRenderer;
|
||||
use BaconQrCode\Renderer\RendererStyle\RendererStyle;
|
||||
use BaconQrCode\Writer;
|
||||
use Friendica\App\BaseURL;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\DI;
|
||||
use Friendica\Module\BaseSettings;
|
||||
use Friendica\Module\Security\Login;
|
||||
use PragmaRX\Google2FA\Google2FA;
|
||||
|
@ -41,32 +39,22 @@ use PragmaRX\Google2FA\Google2FA;
|
|||
*/
|
||||
class Verify extends BaseSettings
|
||||
{
|
||||
/** @var IManagePersonalConfigValues */
|
||||
protected $pConfig;
|
||||
/** @var BaseURL */
|
||||
protected $baseUrl;
|
||||
|
||||
public function __construct(IManagePersonalConfigValues $pConfig, BaseURL $baseUrl, L10n $l10n, array $parameters = [])
|
||||
public function init()
|
||||
{
|
||||
parent::__construct($l10n, $parameters);
|
||||
|
||||
$this->pConfig = $pConfig;
|
||||
$this->baseUrl = $baseUrl;
|
||||
|
||||
if (!local_user()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$secret = $this->pConfig->get(local_user(), '2fa', 'secret');
|
||||
$verified = $this->pConfig->get(local_user(), '2fa', 'verified');
|
||||
$secret = DI::pConfig()->get(local_user(), '2fa', 'secret');
|
||||
$verified = DI::pConfig()->get(local_user(), '2fa', 'verified');
|
||||
|
||||
if ($secret && $verified) {
|
||||
$this->baseUrl->redirect('settings/2fa');
|
||||
DI::baseUrl()->redirect('settings/2fa');
|
||||
}
|
||||
|
||||
if (!self::checkFormSecurityToken('settings_2fa_password', 't')) {
|
||||
notice($this->t('Please enter your password to access this page.'));
|
||||
$this->baseUrl->redirect('settings/2fa');
|
||||
notice(DI::l10n()->t('Please enter your password to access this page.'));
|
||||
DI::baseUrl()->redirect('settings/2fa');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -81,17 +69,17 @@ class Verify extends BaseSettings
|
|||
|
||||
$google2fa = new Google2FA();
|
||||
|
||||
$valid = $google2fa->verifyKey($this->pConfig->get(local_user(), '2fa', 'secret'), $_POST['verify_code'] ?? '');
|
||||
$valid = $google2fa->verifyKey(DI::pConfig()->get(local_user(), '2fa', 'secret'), $_POST['verify_code'] ?? '');
|
||||
|
||||
if ($valid) {
|
||||
$this->pConfig->set(local_user(), '2fa', 'verified', true);
|
||||
DI::pConfig()->set(local_user(), '2fa', 'verified', true);
|
||||
Session::set('2fa', true);
|
||||
|
||||
info($this->t('Two-factor authentication successfully activated.'));
|
||||
info(DI::l10n()->t('Two-factor authentication successfully activated.'));
|
||||
|
||||
$this->baseUrl->redirect('settings/2fa');
|
||||
DI::baseUrl()->redirect('settings/2fa');
|
||||
} else {
|
||||
notice($this->t('Invalid code, please retry.'));
|
||||
notice(DI::l10n()->t('Invalid code, please retry.'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -106,7 +94,7 @@ class Verify extends BaseSettings
|
|||
|
||||
$company = 'Friendica';
|
||||
$holder = Session::get('my_address');
|
||||
$secret = $this->pConfig->get(local_user(), '2fa', 'secret');
|
||||
$secret = DI::pConfig()->get(local_user(), '2fa', 'secret');
|
||||
|
||||
$otpauthUrl = (new Google2FA())->getQRCodeUrl($company, $holder, $secret);
|
||||
|
||||
|
@ -120,7 +108,7 @@ class Verify extends BaseSettings
|
|||
|
||||
$shortOtpauthUrl = explode('?', $otpauthUrl)[0];
|
||||
|
||||
$manual_message = $this->t('<p>Or you can submit the authentication settings manually:</p>
|
||||
$manual_message = DI::l10n()->t('<p>Or you can submit the authentication settings manually:</p>
|
||||
<dl>
|
||||
<dt>Issuer</dt>
|
||||
<dd>%s</dd>
|
||||
|
@ -140,18 +128,18 @@ class Verify extends BaseSettings
|
|||
'$form_security_token' => self::getFormSecurityToken('settings_2fa_verify'),
|
||||
'$password_security_token' => self::getFormSecurityToken('settings_2fa_password'),
|
||||
|
||||
'$title' => $this->t('Two-factor code verification'),
|
||||
'$help_label' => $this->t('Help'),
|
||||
'$message' => $this->t('<p>Please scan this QR Code with your authenticator app and submit the provided code.</p>'),
|
||||
'$title' => DI::l10n()->t('Two-factor code verification'),
|
||||
'$help_label' => DI::l10n()->t('Help'),
|
||||
'$message' => DI::l10n()->t('<p>Please scan this QR Code with your authenticator app and submit the provided code.</p>'),
|
||||
'$qrcode_image' => $qrcode_image,
|
||||
'$qrcode_url_message' => $this->t('<p>Or you can open the following URL in your mobile device:</p><p><a href="%s">%s</a></p>', $otpauthUrl, $shortOtpauthUrl),
|
||||
'$qrcode_url_message' => DI::l10n()->t('<p>Or you can open the following URL in your mobile device:</p><p><a href="%s">%s</a></p>', $otpauthUrl, $shortOtpauthUrl),
|
||||
'$manual_message' => $manual_message,
|
||||
'$company' => $company,
|
||||
'$holder' => $holder,
|
||||
'$secret' => $secret,
|
||||
|
||||
'$verify_code' => ['verify_code', $this->t('Please enter a code from your authentication app'), '', '', $this->t('Required'), 'autofocus autocomplete="off" placeholder="000000"'],
|
||||
'$verify_label' => $this->t('Verify code and enable two-factor authentication'),
|
||||
'$verify_code' => ['verify_code', DI::l10n()->t('Please enter a code from your authentication app'), '', '', DI::l10n()->t('Required'), 'autofocus autocomplete="off" placeholder="000000"'],
|
||||
'$verify_label' => DI::l10n()->t('Verify code and enable two-factor authentication'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue