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:
Jeppe Bundgaard
2026-02-16 14:55:01 +01:00
parent 82e41f45a9
commit 4248de1d7d
4 changed files with 75 additions and 7 deletions
+24
View File
@@ -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;
}
}