Skip to content

Commit

Permalink
standaloneusers - add return values and comment to SendPasswordResetE…
Browse files Browse the repository at this point in the history
…mail::doTask
  • Loading branch information
ufundo committed Dec 5, 2024
1 parent 7afc12b commit 6410d2b
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ class SendPasswordResetEmail extends BasicBatchAction {
* Data we need from the User record
*/
protected function getSelect() {

return ['id', 'username', 'uf_name', 'contact_id'];
}

Expand All @@ -37,6 +36,7 @@ protected function getSelect() {
* @param array $user user record with fields from getSelect
*/
public function doTask($user) {
// TODO: if you disable the reset email template, the action will still reset the token on the user record, which is a bit weird
// (Re)generate token and store on User.
$token = PasswordReset::updateToken($user['id'], $this->timeout);

Expand All @@ -52,8 +52,18 @@ public function doTask($user) {
}
catch (\Exception $e) {
Civi::log()->error("Failed to send password reset to user {$user['id']} ({$user['username']}) to {$user['uf_name']}");
return [
'is_error' => TRUE,
];
}
return [
'is_error' => FALSE,
];
}
return [
'is_error' => TRUE,
'message' => 'No password reset message template available',
];
}

/**
Expand Down

0 comments on commit 6410d2b

Please sign in to comment.