feat: password reset

This commit is contained in:
2026-05-04 08:33:45 +02:00
parent 2c2459c833
commit 0bbc76be1d
5 changed files with 190 additions and 4 deletions
+1 -1
View File
@@ -16,7 +16,7 @@ import (
const (
ScopeActivation = "activation"
ScopeAuthentication = "authentication" // Include a new authentication scope.
ScopePasswordReset = "password-reset"
)
// Define a Token struct to hold the data for an individual token. This includes the
@@ -0,0 +1,38 @@
{{define "subject"}}Reset your Greenlight password{{end}}
{{define "plainBody"}}
Hi,
Please send a `PUT /v1/users/password` request with the following JSON body to set a new password:
{"password": "your new password", "token": "{{.passwordResetToken}}"}
Please note that this is a one-time use token and it will expire in 45 minutes. If you need
another token please make a `POST /v1/tokens/password-reset` request.
Thanks,
The Greenlight Team
{{end}}
{{define "htmlBody"}}
<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<p>Hi,</p>
<p>Please send a <code>PUT /v1/users/password</code> request with the following JSON body to set a new password:</p>
<pre><code>
{"password": "your new password", "token": "{{.passwordResetToken}}"}
</code></pre>
<p>Please note that this is a one-time use token and it will expire in 45 minutes.
If you need another token please make a <code>POST /v1/tokens/password-reset</code> request.</p>
<p>Thanks,</p>
<p>The Greenlight Team</p>
</body>
</html>
{{end}}