mcaptcha/pages/auth/
login.rs

1// Copyright (C) 2022  Aravinth Manivannan <realaravinth@batsense.net>
2// SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
3//
4// SPDX-License-Identifier: AGPL-3.0-or-later
5
6use actix_web::{HttpResponse, Responder};
7use lazy_static::lazy_static;
8use my_codegen::get;
9use sailfish::TemplateOnce;
10
11use crate::PAGES;
12
13#[derive(Clone, TemplateOnce)]
14#[template(path = "auth/login/index.html")]
15struct IndexPage;
16const PAGE: &str = "Login";
17
18impl Default for IndexPage {
19    fn default() -> Self {
20        IndexPage
21    }
22}
23
24lazy_static! {
25    static ref INDEX: String = IndexPage.render_once().unwrap();
26}
27
28#[get(path = "PAGES.auth.login")]
29pub async fn login() -> impl Responder {
30    HttpResponse::Ok()
31        .content_type("text/html; charset=utf-8")
32        .body(&**INDEX)
33}