From 3054999afe82e2bba08547dfc229550234e2c109 Mon Sep 17 00:00:00 2001
From: Raman Tehlan
Date: Thu, 3 May 2018 21:54:06 +0530
Subject: [PATCH 1/2] Display the secret for 2FA - #14128 (#14154)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* 2FA Secret added
* 2FA Secret Displayed
Fix #14128
Signed-off-by: Raman Tehlan
Signed-off-by: Maurício Meneghini Fauth
(cherry picked from commit 8dbae11f6f7ffb8a73f2c9c60976fe6f9ee0d844)
Signed-off-by: Maurício Meneghini Fauth
---
libraries/classes/Plugins/TwoFactor/Application.php | 2 +-
templates/login/twofactor/application_configure.twig | 4 ++++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/libraries/classes/Plugins/TwoFactor/Application.php b/libraries/classes/Plugins/TwoFactor/Application.php
index 6db3ca5505..9993145a50 100644
--- a/libraries/classes/Plugins/TwoFactor/Application.php
+++ b/libraries/classes/Plugins/TwoFactor/Application.php
@@ -97,6 +97,7 @@ class Application extends TwoFactorPlugin
);
return Template::get('login/twofactor/application_configure')->render([
'image' => $inlineUrl,
+ 'secret' => $_SESSION['2fa_application_key']
]);
}
@@ -139,4 +140,3 @@ class Application extends TwoFactorPlugin
return __('Provides authentication using HOTP and TOTP applications such as FreeOTP, Google Authenticator or Authy.');
}
}
-
diff --git a/templates/login/twofactor/application_configure.twig b/templates/login/twofactor/application_configure.twig
index 85fcdf8f25..05f45b51af 100644
--- a/templates/login/twofactor/application_configure.twig
+++ b/templates/login/twofactor/application_configure.twig
@@ -6,5 +6,9 @@
+ {% trans "Secret/key:" %} {{ secret }}
+
+
+{% trans "Authentication code:" %}
{% trans "Authentication code:" %}
From e7a6ff8a0e614de113e88f81244ceada11bdadfc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?=
Date: Thu, 3 May 2018 13:40:33 -0300
Subject: [PATCH 2/2] Remove duplicated input in application_configure.twig
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Some coding style fixes.
Signed-off-by: Maurício Meneghini Fauth
---
libraries/classes/Plugins/TwoFactor/Application.php | 5 +++--
templates/login/twofactor/application_configure.twig | 9 ++++-----
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/libraries/classes/Plugins/TwoFactor/Application.php b/libraries/classes/Plugins/TwoFactor/Application.php
index 9993145a50..3056af3e46 100644
--- a/libraries/classes/Plugins/TwoFactor/Application.php
+++ b/libraries/classes/Plugins/TwoFactor/Application.php
@@ -90,14 +90,15 @@ class Application extends TwoFactorPlugin
*/
public function setup()
{
+ $secret = $this->_twofactor->config['settings']['secret'];
$inlineUrl = $this->_google2fa->getQRCodeInline(
'phpMyAdmin (' . $this->getAppId(false) . ')',
$this->_twofactor->user,
- $this->_twofactor->config['settings']['secret']
+ $secret
);
return Template::get('login/twofactor/application_configure')->render([
'image' => $inlineUrl,
- 'secret' => $_SESSION['2fa_application_key']
+ 'secret' => $secret
]);
}
diff --git a/templates/login/twofactor/application_configure.twig b/templates/login/twofactor/application_configure.twig
index 05f45b51af..b801920379 100644
--- a/templates/login/twofactor/application_configure.twig
+++ b/templates/login/twofactor/application_configure.twig
@@ -1,14 +1,13 @@
{{ Url_getHiddenInputs() }}
-{% trans "Please scan following QR code into the two-factor authentication app on your device and enter authentication code it generates." %}
+ {% trans "Please scan following QR code into the two-factor authentication app on your device and enter authentication code it generates." %}
-
+
- {% trans "Secret/key:" %} {{ secret }}
+ {% trans "Secret/key:" %} {{ secret }}
-{% trans "Authentication code:" %}
-{% trans "Authentication code:" %}
+ {% trans "Authentication code:" %}