email: premium HTML template with accent colour and copy affordance
Redesigns the mail template (branded header bar, hero code block, copy button, muted footer) and adds a configurable accent colour alongside the brand name.
This commit is contained in:
parent
06e9da4dc8
commit
98630c7d36
7 changed files with 63 additions and 22 deletions
|
|
@ -456,8 +456,9 @@ pub struct Db {
|
|||
pub(crate) scram_iterations: u32,
|
||||
// Whether outbound email is configured, so email features can gate themselves.
|
||||
email_enabled: bool,
|
||||
// Display name for email templates.
|
||||
// Display name and accent colour for email templates.
|
||||
email_brand: String,
|
||||
email_accent: String,
|
||||
// Node-local, non-persisted email codes: account -> (purpose, code, expiry).
|
||||
codes: HashMap<String, (CodeKind, String, Instant)>,
|
||||
}
|
||||
|
|
@ -506,7 +507,7 @@ impl Db {
|
|||
apply(&mut accounts, &mut channels, &mut grouped, event);
|
||||
}
|
||||
tracing::info!(accounts = accounts.len(), channels = channels.len(), "account store loaded");
|
||||
Self { accounts, channels, grouped, log, scram_iterations: scram::DEFAULT_ITERATIONS, email_enabled: false, email_brand: "Network Services".to_string(), codes: HashMap::new() }
|
||||
Self { accounts, channels, grouped, log, scram_iterations: scram::DEFAULT_ITERATIONS, email_enabled: false, email_brand: "Network Services".to_string(), email_accent: "#4f46e5".to_string(), codes: HashMap::new() }
|
||||
}
|
||||
|
||||
/// Fold an entry authored by another node into the store — the services-side
|
||||
|
|
@ -738,10 +739,19 @@ impl Db {
|
|||
&self.email_brand
|
||||
}
|
||||
|
||||
/// Accent colour used in email templates.
|
||||
pub fn email_accent(&self) -> &str {
|
||||
&self.email_accent
|
||||
}
|
||||
|
||||
pub fn set_email_brand(&mut self, brand: &str) {
|
||||
self.email_brand = brand.to_string();
|
||||
}
|
||||
|
||||
pub fn set_email_accent(&mut self, accent: &str) {
|
||||
self.email_accent = accent.to_string();
|
||||
}
|
||||
|
||||
/// Issue a fresh emailed code for `account` and purpose, valid for 15 minutes.
|
||||
pub fn issue_code(&mut self, account: &str, kind: CodeKind) -> String {
|
||||
let code = gen_code();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue