Build base web page
This commit is contained in:
@ -5,6 +5,7 @@ use crate::user::{User, UserID};
|
||||
use crate::utils;
|
||||
use actix_session::Session;
|
||||
use actix_web::{web, HttpResponse};
|
||||
use askama::Template;
|
||||
use light_openid::primitives::OpenIDConfig;
|
||||
|
||||
/// Static assets
|
||||
@ -26,6 +27,10 @@ pub async fn static_file(path: web::Path<String>) -> HttpResult {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(askama::Template)]
|
||||
#[template(path = "index.html")]
|
||||
struct HomeTemplate {}
|
||||
|
||||
/// Main route
|
||||
pub async fn home(session: Session) -> HttpResult {
|
||||
// Get user information, requesting authentication if information is missing
|
||||
@ -46,7 +51,9 @@ pub async fn home(session: Session) -> HttpResult {
|
||||
.finish());
|
||||
};
|
||||
|
||||
Ok(HttpResponse::Ok().body("You are authenticated!"))
|
||||
Ok(HttpResponse::Ok()
|
||||
.insert_header(("content-type", "text/html"))
|
||||
.body(HomeTemplate {}.render().unwrap()))
|
||||
}
|
||||
|
||||
#[derive(serde::Deserialize)]
|
||||
|
Reference in New Issue
Block a user