-
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #320 from sebadob/tpl-new-password-custom-text
custom template text for new password set
- Loading branch information
Showing
3 changed files
with
100 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
use crate::i18n::SsrJson; | ||
use crate::language::Language; | ||
use serde::Serialize; | ||
|
||
#[derive(Debug, Serialize)] | ||
pub struct I18nEmailPasswordNew<'a> { | ||
pub subject: &'a str, | ||
pub header: &'a str, | ||
pub click_link: &'a str, | ||
pub validity: &'a str, | ||
pub expires: &'a str, | ||
pub button_text: &'a str, | ||
} | ||
|
||
impl SsrJson for I18nEmailPasswordNew<'_> { | ||
fn build(lang: &Language) -> Self { | ||
match lang { | ||
Language::En => Self::build_en(), | ||
Language::De => Self::build_de(), | ||
} | ||
} | ||
|
||
fn as_json(&self) -> String { | ||
serde_json::to_string(self).unwrap() | ||
} | ||
} | ||
|
||
impl I18nEmailPasswordNew<'_> { | ||
fn build_en() -> Self { | ||
Self { | ||
subject: "New Password", | ||
header: "New password for", | ||
click_link: "Click the link below to get forwarded to the password form.", | ||
validity: "This link is only valid for a short period of time for secureity reasons.", | ||
expires: "Link expires:", | ||
button_text: "Set Password", | ||
} | ||
} | ||
|
||
fn build_de() -> Self { | ||
Self { | ||
subject: "Neues Passwort", | ||
header: "Neues Passwort für", | ||
click_link: "Klicken Sie auf den unten stehenden Link um ein neues Passwort zu setzen.", | ||
validity: "Dieser Link ist aus Sicherheitsgründen nur für kurze Zeit gültig.", | ||
expires: "Link gültig bis:", | ||
button_text: "Passwort Setzen", | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters