clean code; if logged out: save url where user tried to go to, go there once logged in, Fixes #179
Some checks failed
CI/CD Pipeline / deploy-staging (push) Blocked by required conditions
CI/CD Pipeline / deploy-main (push) Blocked by required conditions
CI/CD Pipeline / test (push) Has been cancelled

This commit is contained in:
2024-01-22 22:08:05 +01:00
parent 60b9a4dbba
commit b7499bd6cb
8 changed files with 41 additions and 34 deletions

View File

@ -1,5 +1,4 @@
use rocket::form::Form;
use rocket::fs::TempFile;
use rocket::response::{Flash, Redirect};
use rocket::{get, request::FlashMessage, routes, Route, State};
use rocket::{post, FromForm};
@ -34,28 +33,24 @@ async fn index(
}
#[get("/mail/fee")]
async fn fee(
db: &State<SqlitePool>,
admin: AdminUser,
config: &State<Config>,
flash: Option<FlashMessage<'_>>,
) -> &'static str {
async fn fee(db: &State<SqlitePool>, _admin: AdminUser, config: &State<Config>) -> &'static str {
Mail::fees(db, config.smtp_pw.clone()).await;
"SUCC"
}
#[derive(FromForm, Debug)]
pub struct MailToSend<'a> {
pub struct MailToSend {
//<'a> {
pub(crate) role_id: i32,
pub(crate) subject: String,
pub(crate) body: String,
pub(crate) files: Vec<TempFile<'a>>,
//pub(crate) files: Vec<TempFile<'a>>,
}
#[post("/mail", data = "<data>")]
async fn update(
db: &State<SqlitePool>,
data: Form<MailToSend<'_>>,
data: Form<MailToSend>,
config: &State<Config>,
_admin: AdminUser,
) -> Flash<Redirect> {