From d7434c61a2eee6ec26a0d2c731db71cb37aced10 Mon Sep 17 00:00:00 2001 From: Ilia Ross Date: Sat, 28 Feb 2026 22:17:11 +0200 Subject: [PATCH] Fix to show post-save message about 2FA https://forum.virtualmin.com/t/no-qr-code-displayed-when-selectinc-totp/136703/5 --- webmin/change_twofactor.cgi | 3 ++- webmin/clear_blocked.cgi | 5 ++++- webmin/index.cgi | 4 ++++ webmin/lang/en | 4 ++-- webmin/webmin-lib.pl | 6 ++++-- 5 files changed, 16 insertions(+), 6 deletions(-) diff --git a/webmin/change_twofactor.cgi b/webmin/change_twofactor.cgi index ffc0e6192..7e9092135 100755 --- a/webmin/change_twofactor.cgi +++ b/webmin/change_twofactor.cgi @@ -32,7 +32,8 @@ $miniserv{'twofactor_provider'} = $in{'twofactor_provider'}; &put_miniserv_config(\%miniserv); &unlock_file($ENV{'MINISERV_CONFIG'}); -$msg = $text{'restart_done'}."

\n"; +$msg = ""; +$msg .= $text{'restart_done'}."

\n" if ($gconfig{'restart_async'}); if ($in{'twofactor_provider'}) { $msg .= &text('twofactor_enrolllink', "../acl/twofactor_form.cgi")."

\n"; diff --git a/webmin/clear_blocked.cgi b/webmin/clear_blocked.cgi index 081b77689..ac2d18477 100755 --- a/webmin/clear_blocked.cgi +++ b/webmin/clear_blocked.cgi @@ -3,6 +3,9 @@ require './webmin-lib.pl'; -&show_restart_page($text{'blocked_title'}, $text{'blocked_restarting'}); +&show_restart_page($text{'blocked_title'}, + $gconfig{'restart_async'} + ? $text{'blocked_restarting'} + : undef); diff --git a/webmin/index.cgi b/webmin/index.cgi index 4cea9cef0..6db8c571d 100755 --- a/webmin/index.cgi +++ b/webmin/index.cgi @@ -82,6 +82,10 @@ for(my $i=0; $i<@wlinks; $i++) { $i--; } } + +print &ui_alert_box(&filter_javascript($in{'message'}), 'success', undef, 1, + &html_escape($in{'title'})) if ($in{'message'}); + &icons_table(\@wlinks, \@wtitles, \@wicons); print &ui_hr(); diff --git a/webmin/lang/en b/webmin/lang/en index d673d88ce..84b139160 100644 --- a/webmin/lang/en +++ b/webmin/lang/en @@ -994,7 +994,7 @@ cache_enone=None selected cache_efile=Invalid filename restart_title=Restarting Webmin -restart_done=The Webmin server process is now restarting - please wait for a few seconds before continuing. +restart_done=The Webmin server process is restarting. Please wait a few seconds before continuing. mobile_title=Mobile Device Options mobile_header=Options for mobile browsers @@ -1015,7 +1015,7 @@ blocked_user=Webmin user blocked_host=Client host blocked_clear=Clear All Blocks blocked_cleardesc=Click this button to clear all current host and user blocks, by restarting the Webmin server process. -blocked_restarting=The Webmin server process is now restarting to clear blocked hosts and users - please wait for a few seconds before continuing. +blocked_restarting=The Webmin server process is restarting to clear blocked hosts and users. Please wait a few seconds before continuing. refreshmods_title=Refresh Modules refreshmods_installed=Checking for usable Webmin modules .. diff --git a/webmin/webmin-lib.pl b/webmin/webmin-lib.pl index f2db0fb8f..8660bb1a8 100755 --- a/webmin/webmin-lib.pl +++ b/webmin/webmin-lib.pl @@ -1954,12 +1954,14 @@ Output a page with header and footer about Webmin needing to restart. =cut sub show_restart_page { +my ($title, $msg) = @_; if (!$gconfig{'restart_async'}) { &restart_miniserv(); - &redirect(""); + my $msg_redir = ""; + $msg_redir = "?title=".&urlize($title)."&message=".&urlize($msg) if $msg; + &redirect($msg_redir); return; } -my ($title, $msg) = @_; $title ||= $text{'restart_title'}; $msg ||= $text{'restart_done'}; &ui_print_header(undef, $title, "");