Unsubscribe option available on website

This commit is contained in:
Alphonse Paix
2025-09-22 15:44:02 +02:00
parent a37123a32d
commit f1ce77a762
21 changed files with 400 additions and 91 deletions

View File

@@ -50,6 +50,10 @@ pub struct ConfirmTemplate;
#[template(path = "../templates/404.html")]
pub struct NotFoundTemplate;
#[derive(Template)]
#[template(path = "../templates/unsubscribe_confirm.html")]
pub struct UnsubscribeConfirmTemplate;
#[derive(Template)]
#[template(path = "../templates/unsubscribe.html")]
pub struct UnsubscribeTemplate;
@@ -103,7 +107,7 @@ Alphonse
zero2prod - Building better backends with Rust
Visit the blog: {}
Unsubscribe: {}/unsubscribe?token=UNSUBSCRIBE_TOKEN
Unsubscribe: {}/unsubscribe/confirm?token=UNSUBSCRIBE_TOKEN
You're receiving this because you subscribed to the zero2prod newsletter."#,
self.post_title, self.base_url, self.post_id, self.base_url, self.base_url,
@@ -124,7 +128,7 @@ impl<'a> EmailTemplate for StandaloneEmailTemplate<'a> {
zero2prod - Building better backends with Rust
Visit the blog: {}
Unsubscribe: {}/unsubscribe?token=UNSUBSCRIBE_TOKEN
Unsubscribe: {}/unsubscribe/confirm?token=UNSUBSCRIBE_TOKEN
You're receiving this because you subscribed to the zero2prod newsletter."#,
self.text_content, self.base_url, self.base_url