forked from Ruderverein-Donau-Linz/rowt
clean code; if logged out: save url where user tried to go to, go there once logged in, Fixes #179
This commit is contained in:
@ -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> {
|
||||
|
@ -3,9 +3,9 @@ use std::collections::HashMap;
|
||||
use crate::model::{
|
||||
family::Family,
|
||||
role::Role,
|
||||
user::{AdminUser, Fee, User, UserWithRoles, VorstandUser},
|
||||
user::{AdminUser, User, UserWithRoles, VorstandUser},
|
||||
};
|
||||
use futures::future::{self, join_all};
|
||||
use futures::future::join_all;
|
||||
use rocket::{
|
||||
form::Form,
|
||||
get, post,
|
||||
@ -80,7 +80,7 @@ async fn fees(
|
||||
#[get("/user/fees/paid?<user_ids>")]
|
||||
async fn fees_paid(
|
||||
db: &State<SqlitePool>,
|
||||
admin: AdminUser,
|
||||
_admin: AdminUser,
|
||||
user_ids: Vec<i32>,
|
||||
) -> Flash<Redirect> {
|
||||
let mut res = String::new();
|
||||
|
Reference in New Issue
Block a user