mcaptcha/pages/auth/
sudo.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 std::fmt::Display;
7
8use sailfish::runtime::Render;
9use sailfish::TemplateOnce;
10
11#[derive(Clone, TemplateOnce)]
12#[template(path = "auth/sudo/index.html")]
13pub struct SudoPage<'a, K, V>
14where
15    K: Display + Render,
16    V: Display + Render,
17{
18    url: &'a str,
19    data: Option<Vec<(K, V)>>,
20}
21
22pub const PAGE: &str = "Confirm Access";
23
24impl<'a, K, V> SudoPage<'a, K, V>
25where
26    K: Display + Render,
27    V: Display + Render,
28{
29    //pub fn new(url: &'a str, data: Option<Vec<(&'a str, &'a str)>>) -> Self {
30    pub fn new(url: &'a str, data: Option<Vec<(K, V)>>) -> Self {
31        Self { url, data }
32    }
33}