summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
authormrw1593 <botahamec@outlook.com>2023-06-27 20:41:34 -0400
committermrw1593 <botahamec@outlook.com>2023-06-27 20:41:34 -0400
commit9058b01d6c0e3d1e9e485a537258a312ccfc841c (patch)
tree338334da9d70c59aec3aa5dfd3e3879d23df9f1b /src/resources
parent31f80998a8eef32c0ef2d309bee68ab88f453bab (diff)
Error handling
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/templates.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/resources/templates.rs b/src/resources/templates.rs
index 88c1fad..9168fb9 100644
--- a/src/resources/templates.rs
+++ b/src/resources/templates.rs
@@ -44,6 +44,7 @@ pub enum ErrorPage {
ClientNotFound,
MissingRedirectUri,
InvalidRedirectUri,
+ InternalServerError,
}
pub fn error_page(
@@ -82,3 +83,19 @@ pub fn login_page(
context.insert("params", &serde_urlencoded::to_string(params)?);
tera.render("login.html", &context).unexpect()
}
+
+pub fn login_error_page(
+ tera: &Tera,
+ params: &AuthorizationParameters,
+ language: Language,
+ mut translations: languages::Translations,
+) -> Result<String, RawUnexpected> {
+ translations.refresh()?;
+ let mut tera = extend_tera(tera, language, translations)?;
+ tera.full_reload()?;
+ let mut context = tera::Context::new();
+ context.insert("lang", language.as_str());
+ context.insert("params", &serde_urlencoded::to_string(params)?);
+ context.insert("errorMessage", "loginErrorMessage");
+ tera.render("login.html", &context).unexpect()
+}