send email on successful password change
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<!-- Tell iOS we support light mode -->
|
||||
<meta name="color-scheme" content="light" />
|
||||
<meta name="supported-color-schemes" content="light" />
|
||||
</head>
|
||||
|
||||
<body
|
||||
style="margin: 0; padding: 0; background-color: #f7fff7; color: #000000"
|
||||
>
|
||||
<table
|
||||
width="100%"
|
||||
cellpadding="0"
|
||||
cellspacing="0"
|
||||
border="0"
|
||||
style="background-color: #f7fff7"
|
||||
>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<!-- Outer container -->
|
||||
<table
|
||||
width="600"
|
||||
cellpadding="0"
|
||||
cellspacing="0"
|
||||
border="0"
|
||||
style="
|
||||
background-color: #ffffff;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 12px;
|
||||
margin-top: 25px;
|
||||
"
|
||||
>
|
||||
<tr>
|
||||
<td
|
||||
style="
|
||||
padding: 30px;
|
||||
font-family: Arial, sans-serif;
|
||||
color: #000000;
|
||||
"
|
||||
>
|
||||
<p style="margin: 0 0 15px 0">
|
||||
Hi <strong>{{.Username}}</strong>,
|
||||
</p>
|
||||
|
||||
<p style="margin: 0 0 15px 0">
|
||||
Your account password has been successfully
|
||||
changed. If you made this change, you can
|
||||
safely disregard this email.
|
||||
</p>
|
||||
|
||||
<p style="margin: 20px 0 15px 0">
|
||||
If you did not change your password, please
|
||||
contact your system administrator
|
||||
immediately to secure your account.
|
||||
</p>
|
||||
|
||||
<p style="margin: 0">
|
||||
Thanks,<br />
|
||||
<strong>{{.ServiceName}}</strong>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
@@ -197,6 +197,17 @@ func changePasswordHandler(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
w.WriteHeader(http.StatusOK)
|
||||
w.Write([]byte(`{"success": true}`))
|
||||
|
||||
data := map[string]any{
|
||||
"Username": userData[sessionData.UserID].DisplayName,
|
||||
"ServiceName": "Astral Tech",
|
||||
}
|
||||
|
||||
email_template, err := email.RenderTemplate("./data/email-templates/changed-password.html", data, nil)
|
||||
if err != nil {
|
||||
logging.Errorf("Failed to load email template: %s", err.Error())
|
||||
}
|
||||
noReplyEmail.SendEmail([]string{userData[sessionData.UserID].Email}, "Password expired", email_template)
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
||||
Reference in New Issue
Block a user