Properly handle absense of a prefered language
This commit is contained in:
parent
322c867e94
commit
7690d301f1
@ -313,7 +313,7 @@ pub async fn login(
|
|||||||
config: web::Data<crate::ServerConfig>,
|
config: web::Data<crate::ServerConfig>,
|
||||||
req: HttpRequest,
|
req: HttpRequest,
|
||||||
) -> Result<HttpResponse, ServerError> {
|
) -> Result<HttpResponse, ServerError> {
|
||||||
let language_code = detect_language(&req)?;
|
let language_code = detect_language(&req).unwrap_or_else(|_| "en".to_string());
|
||||||
info!("Detected languagecode: {}", &language_code);
|
info!("Detected languagecode: {}", &language_code);
|
||||||
let mut data = Context::new();
|
let mut data = Context::new();
|
||||||
data.insert("title", "Login");
|
data.insert("title", "Login");
|
||||||
@ -402,7 +402,7 @@ pub async fn redirect(
|
|||||||
);
|
);
|
||||||
let mut data = Context::new();
|
let mut data = Context::new();
|
||||||
data.insert("title", "Wurde gel\u{f6}scht");
|
data.insert("title", "Wurde gel\u{f6}scht");
|
||||||
let language = detect_language(&req)?;
|
let language = detect_language(&req).unwrap_or_else(|_| "en".to_string());
|
||||||
data.insert("language", &language);
|
data.insert("language", &language);
|
||||||
let rendered = tera.render("not_found.html", &data)?;
|
let rendered = tera.render("not_found.html", &data)?;
|
||||||
Ok(HttpResponse::NotFound().body(rendered))
|
Ok(HttpResponse::NotFound().body(rendered))
|
||||||
|
Loading…
Reference in New Issue
Block a user