Skip to content

Commit

Permalink
Add support for no-password mode
Browse files Browse the repository at this point in the history
  • Loading branch information
jcameron committed Feb 2, 2025
1 parent 4a04c10 commit d81ec50
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
15 changes: 10 additions & 5 deletions edit_user.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -716,11 +716,16 @@ else {
}
else {
# For an existing user, offer to change password
$pwfield = &ui_opt_textbox("mailpass", undef, 13,
$text{'user_passdef'}."\n".
(defined($user->{'plainpass'}) ?
&show_password_popup($d, $user) : ""),
$text{'user_passset'});
$popup = defined($user->{'plainpass'}) ?
&show_password_popup($d, $user) : "";
$mode = $user->{'pass'} eq '*' ? 2 : 1;
my @opts;
push(@opts, [ 1, $text{'user_passdef'}.$popup."<br>" ])
if ($mode != 2);
push(@opts, [ 2, $text{'user_passnone'}."<br>" ],
[ 0, $text{'user_passset'}." ".
&ui_textbox("mailpass", undef, 20) ]);
$pwfield = &ui_radio("mailpass_def", $mode, \@opts);
if ($user->{'change'}) {
local $tm = timelocal(gmtime($user->{'change'} *
60*60*24));
Expand Down
1 change: 1 addition & 0 deletions lang/en
Original file line number Diff line number Diff line change
Expand Up @@ -871,6 +871,7 @@ user_surname=Surname
user_real=Real name
user_pass=Password
user_passdef=Leave unchanged
user_passnone=No password accepted
user_passset=Set to ..
user_recovery=Password recovery address
user_norecovery=None set
Expand Down
9 changes: 8 additions & 1 deletion save_user.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,17 @@ else {
$in{'real'} =~ /^[^:\r\n]*$/ ||
&error($text{'user_ereal'});
$user->{'real'} = $in{'real'};
if (!$in{'new'} && $in{'mailpass_def'}) {
if (!$in{'new'} && $in{'mailpass_def'} == 1) {
# Password not being changed
$user->{'passmode'} = 4;
}
elsif ($in{'mailpass_def'} == 2) {
# No passwored accepted
$need_password_check = 0;
delete($user->{'plainpass'});
$user->{'pass'} = '*';
$user->{'passmode'} = 1;
}
else {
# Either password is being changed, or this is new user
$user->{'plainpass'} =
Expand Down

0 comments on commit d81ec50

Please sign in to comment.