mirror of
https://github.com/TheRealOwenRees/chess-endgame-trainer.git
synced 2026-11-18 03:32:06 +00:00
* Send transactional email from no-reply@mail.innersquare.app Centralise the sender identity, reply-to address and SES configuration set in Chesstrainer.Mail so no notifier can drift. Add MAIL_REDIRECT_TO for smoke tests and a mix mail.check task that exercises the SES mailbox simulators, and document the setup in the deploy guide and .env.example. * Tighten crawler metadata and keep play pages out of search Canonical URLs no longer carry query strings, public pages get an OG image, WebSite JSON-LD and a per-page language, and the sitemap dates the landing page only. Play and guest-training routes are marked noindex so tens of thousands of near-identical pages stay out of the index. * Measure built asset sizes with mix assets.sizes Report raw, gzip and brotli sizes for built JS and CSS, and record the current numbers plus the board-code split recommendation in docs/assets.md.
101 lines
2.2 KiB
Elixir
101 lines
2.2 KiB
Elixir
defmodule Chesstrainer.Accounts.UserNotifier do
|
|
import Swoosh.Email
|
|
|
|
alias Chesstrainer.Branding
|
|
alias Chesstrainer.Mail
|
|
|
|
# Delivers the email using the application mailer.
|
|
defp deliver(recipient, subject, body) do
|
|
new()
|
|
|> to(recipient)
|
|
|> subject(subject)
|
|
|> text_body(body)
|
|
|> Mail.deliver()
|
|
end
|
|
|
|
@doc """
|
|
Deliver instructions to confirm account.
|
|
"""
|
|
def deliver_confirmation_instructions(user, url) do
|
|
deliver(user.email, "Confirmation instructions", """
|
|
|
|
==============================
|
|
|
|
Hi #{user.email},
|
|
|
|
You can confirm your account by visiting the URL below:
|
|
|
|
#{url}
|
|
|
|
If you didn't create an account with us, please ignore this.
|
|
|
|
==============================
|
|
""")
|
|
end
|
|
|
|
@doc """
|
|
Deliver an invitation to choose a password.
|
|
|
|
Admins create the account without a password; the invitation link uses the
|
|
same reset-password token flow so the recipient can set one.
|
|
"""
|
|
def deliver_invite_instructions(user, url) do
|
|
deliver(user.email, "You're invited to #{Branding.name()}", """
|
|
|
|
==============================
|
|
|
|
Hi #{user.username},
|
|
|
|
An administrator has created an account for you on #{Branding.name()}.
|
|
|
|
Choose your password by visiting the URL below:
|
|
|
|
#{url}
|
|
|
|
If you weren't expecting this invitation, please ignore this email.
|
|
|
|
==============================
|
|
""")
|
|
end
|
|
|
|
@doc """
|
|
Deliver instructions to reset a user password.
|
|
"""
|
|
def deliver_reset_password_instructions(user, url) do
|
|
deliver(user.email, "Reset password instructions", """
|
|
|
|
==============================
|
|
|
|
Hi #{user.email},
|
|
|
|
You can reset your password by visiting the URL below:
|
|
|
|
#{url}
|
|
|
|
If you didn't request this change, please ignore this.
|
|
|
|
==============================
|
|
""")
|
|
end
|
|
|
|
@doc """
|
|
Deliver instructions to update a user email.
|
|
"""
|
|
def deliver_update_email_instructions(user, url) do
|
|
deliver(user.email, "Update email instructions", """
|
|
|
|
==============================
|
|
|
|
Hi #{user.email},
|
|
|
|
You can change your email by visiting the URL below:
|
|
|
|
#{url}
|
|
|
|
If you didn't request this change, please ignore this.
|
|
|
|
==============================
|
|
""")
|
|
end
|
|
end
|