Skip to content

Commit 4618f59

Browse files
committed
controllers/token: Add API token name to the notification text
1 parent 30f71a2 commit 4618f59

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/controllers/token.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ pub async fn new(app: AppState, req: BytesRequest) -> AppResult<Json<Value>> {
143143

144144
if let Some(recipient) = recipient {
145145
let email = NewTokenEmail {
146+
token_name: name,
146147
user_name: &user.gh_login,
147148
domain: &app.emails.domain,
148149
};
@@ -219,6 +220,7 @@ pub async fn revoke_current(app: AppState, req: Parts) -> AppResult<Response> {
219220
}
220221

221222
struct NewTokenEmail<'a> {
223+
token_name: &'a str,
222224
user_name: &'a str,
223225
domain: &'a str,
224226
}
@@ -231,9 +233,10 @@ impl<'a> crate::email::Email for NewTokenEmail<'a> {
231233
"\
232234
Hello {user_name}!
233235
234-
A new API token was recently added to your {domain} account.
236+
A new API token with the name \"{token_name}\" was recently added to your {domain} account.
235237
236238
If this wasn't you, you should revoke the token immediately: https://{domain}/settings/tokens",
239+
token_name = self.token_name,
237240
user_name = self.user_name,
238241
domain = self.domain,
239242
)

0 commit comments

Comments
 (0)