Changeset View
Changeset View
Standalone View
Standalone View
src/app/Jobs/Password/RetentionEmailJob.php
Show First 20 Lines • Show All 47 Lines • ▼ Show 20 Lines | class RetentionEmailJob implements ShouldQueue | ||||
/** | /** | ||||
* Execute the job. | * Execute the job. | ||||
* | * | ||||
* @return void | * @return void | ||||
*/ | */ | ||||
public function handle() | public function handle() | ||||
{ | { | ||||
if (!$this->user->isLdapReady() || !$this->user->isImapReady()) { | |||||
// The account isn't ready for mail delivery | |||||
return; | |||||
} | |||||
// TODO: Should we check if the password didn't update since | // TODO: Should we check if the password didn't update since | ||||
// the job has been created? | // the job has been created? | ||||
\App\Mail\Helper::sendMail( | \App\Mail\Helper::sendMail( | ||||
new PasswordExpirationReminder($this->user, $this->expiresOn), | new PasswordExpirationReminder($this->user, $this->expiresOn), | ||||
$this->user->tenant_id, | $this->user->tenant_id, | ||||
['to' => $this->user->email] | ['to' => $this->user->email] | ||||
); | ); | ||||
// Remember when we sent the email notification | // Remember when we sent the email notification | ||||
$this->user->setSetting('password_expiration_warning', \now()->toDateTimeString()); | $this->user->setSetting('password_expiration_warning', \now()->toDateTimeString()); | ||||
} | } | ||||
} | } |