Skip to content

Commit 128f451

Browse files
authored
Update expiry notification to use the copy token link (#9049)
1 parent c62f4f2 commit 128f451

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/worker/jobs/expiry_notification.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ fn handle_expiring_token(
8282
debug!("Sending expiry notification to {}…", recipient);
8383
let email = ExpiryNotificationEmail {
8484
name: &user.gh_login,
85+
token_id: token.id,
8586
token_name: &token.name,
8687
expiry_date: token.expired_at.unwrap().and_utc(),
8788
};
@@ -131,6 +132,7 @@ pub fn find_expiring_tokens(
131132
#[derive(Debug, Clone)]
132133
struct ExpiryNotificationEmail<'a> {
133134
name: &'a str,
135+
token_id: i32,
134136
token_name: &'a str,
135137
expiry_date: chrono::DateTime<chrono::Utc>,
136138
}
@@ -144,13 +146,14 @@ impl<'a> Email for ExpiryNotificationEmail<'a> {
144146
145147
We noticed your token "{}" will expire on {}.
146148
147-
If this token is still needed, visit https://crates.io/settings/tokens/new to generate a new one.
149+
If this token is still needed, visit https://crates.io/settings/tokens/new?from={} to generate a new one.
148150
149151
Thanks,
150152
The crates.io team"#,
151153
self.name,
152154
self.token_name,
153-
self.expiry_date.to_rfc3339_opts(SecondsFormat::Secs, true)
155+
self.expiry_date.to_rfc3339_opts(SecondsFormat::Secs, true),
156+
self.token_id
154157
)
155158
}
156159
}

0 commit comments

Comments
 (0)