diff --git a/tinyfilemanager.php b/tinyfilemanager.php index f758869..eca5952 100644 --- a/tinyfilemanager.php +++ b/tinyfilemanager.php @@ -197,7 +197,7 @@ $report_errors = isset($cfg->data['error_reporting']) ? $cfg->data['error_report // Hide Permissions and Owner cols in file-listing $hide_Cols = isset($cfg->data['hide_Cols']) ? $cfg->data['hide_Cols'] : true; -// Use 2FA authentication for all users +// Use 2FA Authentication for all users $use_2FA = isset($cfg->data['use_2FA']) ? $cfg->data['use_2FA'] : true; // Theme $theme = isset($cfg->data['theme']) ? $cfg->data['theme'] : 'light'; @@ -342,27 +342,20 @@ if ($use_auth) { // Generate random OTP secret, manually add entry inside '$otp_secrets' array if (!isset($otp_secrets[$_POST['fm_usr']])) { - $QR_onlineAPI = 0; + $QR_onlineAPI = false; $random_Base32_InitKey = Google2FA::generate_secret_key(56); $otp_uri = "otpauth://totp/TFM:$_POST[fm_usr]@$_SERVER[SERVER_NAME]?secret=$random_Base32_InitKey&issuer=TFM&algorithm=SHA1&digits=6&period=30"; - //$qr_gen_api = "https://api.qrserver.com/v1/create-qr-code/?size=200x200&ecc=L&data="; - $qr_gen_api = "https://chart.googleapis.com/chart?cht=qr&chs=200x200&chld=L|0&chl="; + echo ''; echo '

New OTP secret generated!

Add the secret below to the $otp_secrets array and scan the QR code to add it to your personal 2FA vault.

'; - echo "'$_POST[fm_usr]' => '$random_Base32_InitKey'


"; - if ($QR_onlineAPI != 0) echo 'QR Code'; - if ($QR_onlineAPI == 0) { + echo "'$_POST[fm_usr]' => '$random_Base32_InitKey'


"; + if ($QR_onlineAPI) { + $qr_gen_api = "https://api.qrserver.com/v1/create-qr-code/?size=200x200&ecc=L&data="; + $qr_gen_api = "https://chart.googleapis.com/chart?cht=qr&chs=200x200&chld=L|0&chl="; + echo 'QR Code'; + } else { echo ''; echo '
'; - echo ''; + echo ''; } unset($_SESSION[FM_SESSION_ID]['logged']); exit; @@ -1630,7 +1623,7 @@ if (isset($_GET['settings']) && !FM_READONLY) {
- +
/>