add site key form

This commit is contained in:
realaravinth
2021-05-03 20:24:03 +05:30
parent 0531a26274
commit 812b0ff2c9
49 changed files with 1253 additions and 597 deletions

View File

@@ -18,6 +18,8 @@
use actix_web::{HttpResponse, Responder};
use sailfish::TemplateOnce;
use crate::pages::TITLE;
pub mod sitekey;
#[derive(TemplateOnce, Clone)]
@@ -27,13 +29,13 @@ pub struct IndexPage<'a> {
pub title: &'a str,
}
const TITLE: &str = "Dashboard";
const COMPONENT: &str = "Dashboard";
impl<'a> Default for IndexPage<'a> {
fn default() -> Self {
IndexPage {
name: "mCaptcha",
title: TITLE,
name: TITLE,
title: COMPONENT,
}
}
}

View File

@@ -18,6 +18,8 @@
use actix_web::{HttpResponse, Responder};
use sailfish::TemplateOnce;
use crate::pages::TITLE;
#[derive(TemplateOnce, Clone)]
#[template(path = "panel/add-site-key/index.html")]
pub struct IndexPage<'a> {
@@ -28,13 +30,13 @@ pub struct IndexPage<'a> {
pub form_description: &'a str,
}
const TITLE: &str = "Add Site Key";
const COMPONENT: &str = "Add Site Key";
impl<'a> Default for IndexPage<'a> {
fn default() -> Self {
IndexPage {
name: "mCaptcha",
title: TITLE,
name: TITLE,
title: COMPONENT,
levels: 1,
form_description: "",
form_title: "Add Site Key",

View File

@@ -0,0 +1,44 @@
/*
* Copyright (C) 2021 Aravinth Manivannan <realaravinth@batsense.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
use actix_web::{HttpResponse, Responder};
use sailfish::TemplateOnce;
#[derive(TemplateOnce, Clone)]
#[template(path = "panel/site-keys/index.html")]
pub struct IndexPage<'a> {
pub name: &'a str,
pub title: &'a str,
}
const TITLE: &str = "Add Site Key";
impl<'a> Default for IndexPage<'a> {
fn default() -> Self {
IndexPage {
name: "mCaptcha",
title: TITLE,
}
}
}
pub async fn list_sitekeys() -> impl Responder {
let body = IndexPage::default().render_once().unwrap();
HttpResponse::Ok()
.content_type("text/html; charset=utf-8")
.body(body)
}

View File

@@ -16,6 +16,7 @@
*/
mod add;
mod list;
pub mod routes {
pub struct Sitekey {
@@ -43,4 +44,11 @@ pub fn services(cfg: &mut actix_web::web::ServiceConfig) {
Methods::ProtectGet,
add::add_sitekey
);
define_resource!(
cfg,
PAGES.panel.sitekey.list,
Methods::ProtectGet,
list::list_sitekeys
);
}