From b4c6061a9a903431f0d2cb33f5bbc832620f6f48 Mon Sep 17 00:00:00 2001 From: Maxim Leshchenko Date: Thu, 2 Dec 2021 18:12:45 +0200 Subject: [PATCH] Fixup "Users: Add two-factor authentication" Make the background of the QR code white, correct the text of the enable message and remove audios from the left menu --- Web/Presenters/UserPresenter.php | 8 +++++--- Web/Presenters/templates/User/Settings.xml | 11 ----------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/Web/Presenters/UserPresenter.php b/Web/Presenters/UserPresenter.php index 4eae74e5..2edea129 100644 --- a/Web/Presenters/UserPresenter.php +++ b/Web/Presenters/UserPresenter.php @@ -11,7 +11,7 @@ use openvk\Web\Models\Repositories\Notes; use openvk\Web\Models\Repositories\Vouchers; use Chandler\Security\Authenticator; use lfkeitel\phptotp\{Base32, Totp}; -use chillerlan\QRCode\QRCode; +use chillerlan\QRCode\{QRCode, QROptions}; final class UserPresenter extends OpenVKPresenter { @@ -418,7 +418,7 @@ final class UserPresenter extends OpenVKPresenter $this->user->identity->set2fa_secret($secret); $this->user->identity->save(); - $this->flash("succ", tr("two_factor_authentication_enabled"), tr("two_factor_authentication_enabled_description")); + $this->flash("succ", tr("two_factor_authentication_enabled_message"), tr("two_factor_authentication_enabled_message_description")); $this->redirect("/settings"); } @@ -430,7 +430,9 @@ final class UserPresenter extends OpenVKPresenter $issuer = OPENVK_ROOT_CONF["openvk"]["appearance"]["name"]; $email = $this->user->identity->getEmail(); - $this->template->qrCode = substr((new QRCode)->render("otpauth://totp/$issuer:$email?secret=$secret&issuer=$issuer"), 22); + $this->template->qrCode = substr((new QRCode(new QROptions([ + "imageTransparent" => false + ])))->render("otpauth://totp/$issuer:$email?secret=$secret&issuer=$issuer"), 22); } function renderDisableTwoFactorAuth(): void diff --git a/Web/Presenters/templates/User/Settings.xml b/Web/Presenters/templates/User/Settings.xml index 20698eed..20ba7420 100644 --- a/Web/Presenters/templates/User/Settings.xml +++ b/Web/Presenters/templates/User/Settings.xml @@ -464,17 +464,6 @@ {_my_videos} - - - - - - {_my_audios} - -