Display login page

This commit is contained in:
2022-03-30 11:00:20 +02:00
parent 5bc4af399d
commit 70aaa1ff44
6 changed files with 171 additions and 10 deletions

View File

@ -1,15 +1,35 @@
use actix_web::Responder;
use actix_web::{HttpResponse, Responder};
use askama::Template;
use crate::constants::APP_NAME;
#[derive(Template)]
#[template(path = "base_login_page.html")]
struct BaseLoginPage {
danger: String,
success: String,
page_title: &'static str,
app_name: &'static str,
}
#[derive(Template)]
#[template(path = "login.html")]
struct LoginTemplate<'a> {
app_name: &'a str,
struct LoginTemplate {
_parent: BaseLoginPage,
mail: String,
}
pub async fn login_route() -> impl Responder {
LoginTemplate { app_name: APP_NAME }.render().unwrap()
HttpResponse::Ok()
.content_type("text/html")
.body(LoginTemplate {
_parent: BaseLoginPage {
page_title: "Login",
danger: "".to_string(),
success: "".to_string(),
app_name: APP_NAME,
},
mail: "".to_string()
}.render().unwrap())
}