mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2026-02-12 18:45:41 +00:00
add site key form
This commit is contained in:
@@ -18,6 +18,8 @@
|
||||
use actix_web::{HttpResponse, Responder};
|
||||
use sailfish::TemplateOnce;
|
||||
|
||||
use crate::pages::TITLE;
|
||||
|
||||
#[derive(Clone, TemplateOnce)]
|
||||
#[template(path = "auth/login/index.html")]
|
||||
struct IndexPage<'a> {
|
||||
@@ -28,7 +30,7 @@ struct IndexPage<'a> {
|
||||
impl<'a> Default for IndexPage<'a> {
|
||||
fn default() -> Self {
|
||||
IndexPage {
|
||||
name: "mCaptcha",
|
||||
name: TITLE,
|
||||
title: "Login",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
use actix_web::{HttpResponse, Responder};
|
||||
use sailfish::TemplateOnce;
|
||||
|
||||
use crate::pages::TITLE;
|
||||
|
||||
#[derive(TemplateOnce, Clone)]
|
||||
#[template(path = "auth/register/index.html")]
|
||||
struct IndexPage<'a> {
|
||||
@@ -28,7 +30,7 @@ struct IndexPage<'a> {
|
||||
impl<'a> Default for IndexPage<'a> {
|
||||
fn default() -> Self {
|
||||
IndexPage {
|
||||
name: "mCaptcha",
|
||||
name: TITLE,
|
||||
title: "Join",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,8 @@ mod auth;
|
||||
mod panel;
|
||||
pub mod routes;
|
||||
|
||||
pub const TITLE: &str = "mCaptcha";
|
||||
|
||||
pub fn services(cfg: &mut ServiceConfig) {
|
||||
auth::services(cfg);
|
||||
panel::services(cfg);
|
||||
@@ -59,7 +61,11 @@ mod tests {
|
||||
)
|
||||
.await;
|
||||
|
||||
let urls = vec![PAGES.home, PAGES.panel.sitekey.add];
|
||||
let urls = vec![
|
||||
PAGES.home,
|
||||
PAGES.panel.sitekey.add,
|
||||
PAGES.panel.sitekey.list,
|
||||
];
|
||||
|
||||
for url in urls.iter() {
|
||||
let resp =
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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",
|
||||
|
||||
44
src/pages/panel/sitekey/list.rs
Normal file
44
src/pages/panel/sitekey/list.rs
Normal 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)
|
||||
}
|
||||
@@ -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
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user