2022-03-30 09:00:20 +00:00
|
|
|
use actix_web::{HttpResponse, Responder};
|
2022-03-30 08:29:10 +00:00
|
|
|
use askama::Template;
|
|
|
|
|
|
|
|
use crate::constants::APP_NAME;
|
|
|
|
|
2022-03-30 09:00:20 +00:00
|
|
|
#[derive(Template)]
|
|
|
|
#[template(path = "base_login_page.html")]
|
|
|
|
struct BaseLoginPage {
|
|
|
|
danger: String,
|
|
|
|
success: String,
|
|
|
|
page_title: &'static str,
|
|
|
|
app_name: &'static str,
|
|
|
|
}
|
|
|
|
|
2022-03-30 08:29:10 +00:00
|
|
|
#[derive(Template)]
|
|
|
|
#[template(path = "login.html")]
|
2022-03-30 09:00:20 +00:00
|
|
|
struct LoginTemplate {
|
|
|
|
_parent: BaseLoginPage,
|
|
|
|
mail: String,
|
2022-03-30 08:29:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pub async fn login_route() -> impl Responder {
|
2022-03-30 09:00:20 +00:00
|
|
|
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())
|
2022-03-30 08:29:10 +00:00
|
|
|
}
|