Skip to content

Commit

Permalink
issue: User/Agent Password Reset
Browse files Browse the repository at this point in the history
This addresses an issue where password reset is triggered even though the
user/agent doesn’t have a password or the authentication backend is
external.
  • Loading branch information
JediKev committed Sep 28, 2022
1 parent b1e5386 commit d3de159
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
3 changes: 3 additions & 0 deletions pwreset.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
if (!$acct->isPasswdResetEnabled()) {
$banner = __('Password reset is not enabled for your account. Contact your administrator');
}
elseif (!$acct->hasPassword()
|| (($bk=$acct->backend) && ($bk !== 'local')))
$banner = __('Unable to reset password. Contact your administrator');
elseif ($acct->sendResetEmail()) {
$inc = 'pwreset.sent.php';
}
Expand Down
12 changes: 4 additions & 8 deletions scp/pwreset.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,11 @@
$userid = (string) $_POST['userid'];
if (Validator::is_userid($userid)
&& ($staff=Staff::lookup($userid))) {
if (!$staff->hasPassword()) {
if ($staff->sendResetEmail('registration-staff', false) !== false)
$msg = __('Registration email sent successfully.');
else
$msg = __('Unable to reset password. Contact your administrator');
}
elseif (!$staff->sendResetEmail()) {
if (!$staff->hasPassword()
|| (($bk=$staff->getAuthBackend()) && !($bk instanceof osTicketStaffAuthentication)))
$msg = __('Unable to reset password. Contact your administrator');
elseif (!$staff->sendResetEmail())
$tpl = 'pwreset.sent.php';
}
}
else
$tpl = 'pwreset.sent.php';
Expand Down

0 comments on commit d3de159

Please sign in to comment.