68 lines
1.5 KiB
Rust
68 lines
1.5 KiB
Rust
use crate::{
|
|
filters,
|
|
models::{Area, Role, User},
|
|
};
|
|
use askama::Template;
|
|
use serde::Deserialize;
|
|
|
|
pub mod delete;
|
|
pub mod get_changepassword;
|
|
pub mod get_edit;
|
|
pub mod get_login;
|
|
pub mod get_logout;
|
|
pub mod get_new;
|
|
pub mod get_overview;
|
|
pub mod get_profile;
|
|
pub mod get_register;
|
|
pub mod get_reset;
|
|
pub mod post_changepassword;
|
|
pub mod post_edit;
|
|
pub mod post_login;
|
|
pub mod post_new;
|
|
pub mod post_register;
|
|
pub mod post_resend_registration;
|
|
pub mod post_reset;
|
|
pub mod put_receive_notifications;
|
|
pub mod put_lock;
|
|
|
|
#[derive(Template)]
|
|
#[template(path = "user/new_or_edit.html")]
|
|
pub struct NewOrEditUserTemplate {
|
|
user: User,
|
|
areas: Option<Vec<Area>>,
|
|
id: Option<i32>,
|
|
email: Option<String>,
|
|
name: Option<String>,
|
|
role: Option<u8>,
|
|
is_posten: Option<bool>,
|
|
is_wachhabender: Option<bool>,
|
|
is_fuehrungsassistent: Option<bool>,
|
|
area_id: Option<i32>,
|
|
}
|
|
|
|
#[derive(Deserialize, Debug)]
|
|
#[cfg_attr(test, derive(serde::Serialize))]
|
|
struct NewOrEditUserForm {
|
|
email: String,
|
|
name: String,
|
|
role: u8,
|
|
#[serde(rename = "is-posten")]
|
|
is_posten: Option<bool>,
|
|
#[serde(rename = "is-wachhabender")]
|
|
is_wachhabender: Option<bool>,
|
|
#[serde(rename = "is-fuehrungsassistent")]
|
|
is_fuehrungsassistent: Option<bool>,
|
|
area: Option<i32>,
|
|
}
|
|
|
|
#[derive(Template)]
|
|
#[template(path = "user/change_password.html")]
|
|
struct ResetPasswordTemplate<'a> {
|
|
token: &'a str,
|
|
title: &'a str,
|
|
endpoint: &'a str,
|
|
new_password_label: &'a str,
|
|
retype_label: &'a str,
|
|
submit_button_label: &'a str,
|
|
}
|