Add password reset link generation and welcome email functionality
- Introduce `generatePasswordResetLink` method in `users_o` for creating secure password reset links. - Add `sendWelcomeEmailToCustomer` method to `email` class with support for attachments. - Update `authRoute.php` to send welcome emails when creating new customers. - Extend `sendEmail` to handle optional attachments and references. - Disable PHP entrypoint in Dockerfile for improved flexibility.
This commit is contained in:
@@ -1478,4 +1478,28 @@ class users_o extends db
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate password reset link for the user
|
||||
* @return string The password reset link
|
||||
* @throws Exception If the user is not selected
|
||||
* @throws Exception If the user does not have an email address
|
||||
*/
|
||||
public function generatePasswordResetLink(): string
|
||||
{
|
||||
self::requireSelected();
|
||||
// Generate token
|
||||
$token = customer_password_reset_keys_o::generateToken();
|
||||
|
||||
// Save token
|
||||
$reset_key_o = new customer_password_reset_keys_o();
|
||||
$reset_key_o->add([
|
||||
'customer_id' => (int)$this->customer_number->value(),
|
||||
'token' => (string)$token,
|
||||
'note' => 'Requested via API'
|
||||
]);
|
||||
|
||||
// Generate reset link
|
||||
return "https://truckwash.io/auth/password-reset/" . $token;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user