pub struct AuthMail { /* private fields */ }Expand description
Where a panel’s auth mail comes from and where its links point, installed with
Auth::mail: the sender, and the absolute URL every link starts with.
use tablo_core::{Auth, AuthMail, PasswordAuth, PasswordReset};
use topcoat::mail::Mailbox;
let auth = Auth::password()
.mail(AuthMail::new(
Mailbox::named("Example", "no-reply@example.com")?,
"https://admin.example.com",
))
.password_reset(PasswordReset::new(PasswordAuth::new()));The base URL is configuration, not the request’s Host header, which the client chooses: a
link built from it could point a victim’s email at another host. Mounting refuses a base URL
that is not an absolute http or https URL, or that carries a query or fragment.
The mail goes out through the router’s Mailer, which the app adds
with .with(Mailer::new(..)) before mounting the panel and without which mounting refuses the
panel, or through the delivery the app installs.
Implementations§
Source§impl AuthMail
impl AuthMail
Sourcepub fn new(from: Mailbox, base_url: impl Into<String>) -> AuthMail
pub fn new(from: Mailbox, base_url: impl Into<String>) -> AuthMail
Mails from from, with links that start with base_url, such as
https://admin.example.com: the scheme and host the app answers on, before the panel’s
prefix.
Sourcepub fn delivery(self, delivery: impl AuthMailDelivery) -> AuthMail
pub fn delivery(self, delivery: impl AuthMailDelivery) -> AuthMail
Hands each letter to delivery inside the transaction that records its token, in place of
sending it through the router’s Mailer once that commits: see AuthMailDelivery.
Mounting then needs no Mailer.