error correction, tests for err branches, rm get_token, get_token,

delete captcha
This commit is contained in:
realaravinth
2021-07-17 17:43:53 +05:30
parent 6f690734c5
commit 8f87efeeb3
14 changed files with 252 additions and 114 deletions

View File

@@ -61,6 +61,7 @@ mod tests {
PAGES.panel.sitekey.add,
PAGES.panel.sitekey.list,
PAGES.panel.notifications,
"/sitekey/test/delete",
];
for url in urls.iter() {

View File

@@ -0,0 +1,45 @@
/*
* 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 lazy_static::lazy_static;
use my_codegen::get;
use sailfish::TemplateOnce;
use crate::PAGES;
#[derive(Clone, TemplateOnce)]
#[template(path = "panel/sitekey/delete/index.html")]
struct IndexPage;
const PAGE: &str = "Confirm Access";
impl Default for IndexPage {
fn default() -> Self {
IndexPage
}
}
lazy_static! {
static ref INDEX: String = IndexPage::default().render_once().unwrap();
}
#[get(path = "PAGES.panel.sitekey.delete", wrap = "crate::CheckLogin")]
pub async fn delete_sitekey() -> impl Responder {
HttpResponse::Ok()
.content_type("text/html; charset=utf-8")
.body(&*INDEX)
}

View File

@@ -0,0 +1,45 @@
/*
* 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 lazy_static::lazy_static;
use my_codegen::get;
use sailfish::TemplateOnce;
use crate::PAGES;
#[derive(Clone, TemplateOnce)]
#[template(path = "auth/login/index.html")]
struct IndexPage;
const PAGE: &str = "Login";
impl Default for IndexPage {
fn default() -> Self {
IndexPage
}
}
lazy_static! {
static ref INDEX: String = IndexPage::default().render_once().unwrap();
}
#[get(path = "PAGES.auth.login")]
pub async fn login() -> impl Responder {
HttpResponse::Ok()
.content_type("text/html; charset=utf-8")
.body(&*INDEX)
}

View File

@@ -16,6 +16,7 @@
*/
mod add;
mod delete;
mod edit;
pub mod list;
mod view;
@@ -26,6 +27,7 @@ pub mod routes {
pub add: &'static str,
pub view: &'static str,
pub edit: &'static str,
pub delete: &'static str,
}
impl Sitekey {
@@ -35,6 +37,7 @@ pub mod routes {
add: "/sitekeys/add",
view: "/sitekey/{key}",
edit: "/sitekey/{key}/edit",
delete: "/sitekey/{key}/delete",
}
}
}
@@ -45,4 +48,5 @@ pub fn services(cfg: &mut actix_web::web::ServiceConfig) {
cfg.service(list::list_sitekeys);
cfg.service(view::view_sitekey);
cfg.service(edit::edit_sitekey);
cfg.service(delete::delete_sitekey);
}