1 defmodule Pleroma.UserEmail do
2 @moduledoc "User emails"
6 alias Pleroma.Web.{Endpoint, Router}
8 defp instance_config, do: Pleroma.Config.get(:instance)
10 defp instance_name, do: instance_config()[:name]
13 {instance_name(), instance_config()[:email]}
16 defp recipient(email, nil), do: email
17 defp recipient(email, name), do: {name, email}
19 def password_reset_email(user, password_reset_token) when is_binary(password_reset_token) do
21 Router.Helpers.util_url(
28 <h3>Reset your password at #{instance_name()}</h3>
29 <p>Someone has requested password change for your account at #{instance_name()}.</p>
30 <p>If it was you, visit the following link to proceed: <a href="#{password_reset_url}">reset password</a>.</p>
31 <p>If it was someone else, nothing to worry about: your data is secure and your password has not been changed.</p>
35 |> to(recipient(user.email, user.name))
37 |> subject("Password reset")
38 |> html_body(html_body)