Use the same message for wrong user and password

This commit is contained in:
Jamie Cameron 2024-08-14 03:08:26 -07:00
parent 7198370f9b
commit efccfc4db6
2 changed files with 5 additions and 4 deletions

View File

@ -287,6 +287,7 @@ password_done=Your password has been successfully changed. You may now <a href='
password_err=Failed to change password
password_euser=Your login name was not found in the password file!
password_eold=The current password is incorrect
password_euserpass=Invalid username or password
password_enew1=No new password was entered
password_enew2=Your new passwords do not match
password_epam=PAM error : $1

View File

@ -39,7 +39,7 @@ if (!$in{'pam'} && !$wuser) {
if ($wuser) {
# Update Webmin user's password
$ok = &acl::validate_password($in{'old'}, $wuser->{'pass'});
$ok || &pass_error($text{'password_eold'});
$ok || &pass_error($text{'password_euserpass'});
$perr = &acl::check_password_restrictions($in{'user'}, $in{'new1'});
$perr && &pass_error(&text('password_enewpass', $perr));
$wuser->{'pass'} = &acl::encrypt_password($in{'new1'});
@ -117,7 +117,7 @@ elsif ($in{'pam'}) {
$pamh = new Authen::PAM($service, $in{'user'}, \&pam_check_func);
$rv = $pamh->pam_authenticate();
$rv == PAM_SUCCESS() ||
&pass_error($text{'password_eold'});
&pass_error($text{'password_euserpass'});
$pamh = undef;
# Change the password with PAM, in a sub-process. This is needed because
@ -159,12 +159,12 @@ else {
last;
}
}
defined($idx) || &pass_error($text{'password_euser'});
defined($idx) || &pass_error($text{'password_euserpass'});
# Validate old password
&unix_crypt($in{'old'}, $line[$miniserv{'passwd_pindex'}]) eq
$line[$miniserv{'passwd_pindex'}] ||
&pass_error($text{'password_eold'});
&pass_error($text{'password_euserpass'});
# Make sure new password meets restrictions
if (&foreign_check("changepass")) {