fix: urlencode email in reset password link (#15167)

Fixes https://github.com/coder/coder/issues/15151

This runs `urlencode` (provided by `text/template`) on the email address
in the link. This ensures the link will work if a user has an email in
the form `user+label@example.com`.
This commit is contained in:
Danielle Maywood
2024-10-21 16:09:59 +01:00
committed by GitHub
parent 13f6645ab9
commit 23f61c68b4
5 changed files with 19 additions and 8 deletions
@@ -0,0 +1,10 @@
UPDATE notification_templates
SET
title_template = E'Reset your password for Coder',
body_template = E'Hi {{.UserName}},\n\nUse the link below to reset your password.\n\nIf you did not make this request, you can ignore this message.',
actions = '[{
"label": "Reset password",
"url": "{{base_url}}/reset-password/change?otp={{.Labels.one_time_passcode}}&email={{.UserEmail | urlquery}}"
}]'::jsonb
WHERE
id = '62f86a30-2330-4b61-a26d-311ff3b608cf'