From 1b9b9ae21fda70c1aec033f92186928aff7ace02 Mon Sep 17 00:00:00 2001 From: Ilia Ross Date: Tue, 10 Mar 2026 23:31:47 +0200 Subject: [PATCH] Fix to show test form for two-factor only when enrolling for yourself --- acl/save_twofactor.cgi | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/acl/save_twofactor.cgi b/acl/save_twofactor.cgi index ec0b8cea9..fe1da3fe7 100755 --- a/acl/save_twofactor.cgi +++ b/acl/save_twofactor.cgi @@ -66,14 +66,17 @@ if ($in{'enable'}) { { 'provider' => $user->{'twofactor_provider'}, 'id' => $user->{'twofactor_id'} }); - # Show a test form, so the user can validate - print &ui_form_start("test_twofactor.cgi"); - print $text{'twofactor_testdesc'},"

\n"; - print "$text{'twofactor_testfield'} \n", - &ui_textbox("test", undef, 12),"\n"; - print &ui_hidden("user", $in{'user'}) if ($in{'user'}); - print "

\n"; - print &ui_form_end([ [ undef, $text{'twofactor_test'} ] ]); + # Show a test form only when enrolling for yourself + if ($user->{'name'} eq $base_remote_user) { + print &ui_form_start("test_twofactor.cgi"); + print $text{'twofactor_testdesc'},"

\n"; + print "$text{'twofactor_testfield'} \n", + &ui_textbox("test", undef, 12),"\n"; + print &ui_hidden("user", $in{'user'}) if ($in{'user'}); + print "

\n"; + print &ui_form_end([ [ undef, + $text{'twofactor_test'} ] ]); + } } &ui_print_footer("", $text{'index_return'});