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,12 +1,8 @@
use std::error::Error;
use lettre::{
message::{
header::{self, ContentType},
MultiPart, SinglePart,
},
transport::smtp::authentication::Credentials,
Message, SmtpTransport, Transport,
message::header::ContentType, transport::smtp::authentication::Credentials, Message,
SmtpTransport, Transport,
};
use sqlx::SqlitePool;
@ -17,7 +13,7 @@ use super::{family::Family, role::Role, user::User};
pub struct Mail {}
impl Mail {
pub async fn send(db: &SqlitePool, data: MailToSend<'_>, smtp_pw: String) -> bool {
pub async fn send(db: &SqlitePool, data: MailToSend, smtp_pw: String) -> bool {
let mut email = Message::builder()
.from(
"ASKÖ Ruderverein Donau Linz <no-reply@rudernlinz.at>"

View File

@ -2,7 +2,6 @@ use std::ops::{Deref, DerefMut};
use argon2::{password_hash::SaltString, Argon2, PasswordHasher};
use chrono::{Datelike, Local, NaiveDate};
use chrono_tz::Etc::UTC;
use log::info;
use rocket::{
async_trait,
@ -101,12 +100,12 @@ pub enum LoginError {
}
#[derive(Debug, Serialize)]
pub(crate) struct Fee {
pub(crate) sum_in_cents: i32,
pub(crate) parts: Vec<(String, i32)>,
pub(crate) name: String,
pub(crate) user_ids: String,
pub(crate) paid: bool,
pub struct Fee {
pub sum_in_cents: i32,
pub parts: Vec<(String, i32)>,
pub name: String,
pub user_ids: String,
pub paid: bool,
}
impl Fee {
@ -156,7 +155,6 @@ impl User {
let mut fee = Fee::new();
if let Some(family) = Family::find_by_opt_id(db, self.family_id).await {
let mut names = String::new();
for member in family.members(db).await {
fee.add_person(&member);
if member.has_role(db, "paid").await {