1 Commits

Author SHA1 Message Date
4d290df1d5 Update Rust crate anyhow to 1.0.98 2025-04-30 00:19:08 +00:00
21 changed files with 444 additions and 573 deletions

File diff suppressed because it is too large Load Diff

@ -11,46 +11,46 @@
}, },
"dependencies": { "dependencies": {
"@emotion/react": "^11.14.0", "@emotion/react": "^11.14.0",
"@emotion/styled": "^11.14.1", "@emotion/styled": "^11.14.0",
"@fontsource/roboto": "^5.2.6", "@fontsource/roboto": "^5.2.5",
"@fullcalendar/core": "^6.1.18", "@fullcalendar/core": "^6.1.15",
"@fullcalendar/daygrid": "^6.1.18", "@fullcalendar/daygrid": "^6.1.15",
"@fullcalendar/interaction": "^6.1.18", "@fullcalendar/interaction": "^6.1.15",
"@fullcalendar/list": "^6.1.18", "@fullcalendar/list": "^6.1.15",
"@fullcalendar/react": "^6.1.18", "@fullcalendar/react": "^6.1.15",
"@mdi/js": "^7.4.47", "@mdi/js": "^7.4.47",
"@mdi/react": "^1.6.1", "@mdi/react": "^1.6.1",
"@mui/icons-material": "^7.2.0", "@mui/icons-material": "^7.0.0",
"@mui/lab": "^7.0.0-beta.14", "@mui/lab": "^7.0.0-beta.11",
"@mui/material": "^7.2.0", "@mui/material": "^7.0.0",
"@mui/x-data-grid": "^7.29.8", "@mui/x-data-grid": "^7.28.2",
"@mui/x-date-pickers": "^7.29.4", "@mui/x-date-pickers": "^7.28.2",
"@mui/x-tree-view": "^7.29.1", "@mui/x-tree-view": "^7.28.1",
"date-and-time": "^3.6.0", "date-and-time": "^3.6.0",
"dayjs": "^1.11.13", "dayjs": "^1.11.13",
"email-validator": "^2.0.4", "email-validator": "^2.0.4",
"filesize": "^10.1.6", "filesize": "^10.1.6",
"jspdf": "^3.0.1", "jspdf": "^3.0.1",
"mui-color-input": "^7.0.0", "mui-color-input": "^7.0.0",
"react": "^19.1.0", "react": "^19.0.0",
"react-dom": "^19.1.0", "react-dom": "^19.0.0",
"react-easy-crop": "^5.4.2", "react-easy-crop": "^5.4.1",
"react-qr-code": "^2.0.18", "react-qr-code": "^2.0.15",
"react-router-dom": "^7.4.0", "react-router-dom": "^7.4.0",
"react-zoom-pan-pinch": "^3.7.0", "react-zoom-pan-pinch": "^3.7.0",
"svg2pdf.js": "^2.5.0" "svg2pdf.js": "^2.5.0"
}, },
"devDependencies": { "devDependencies": {
"@eslint/js": "^9.30.1", "@eslint/js": "^9.25.1",
"@types/react": "^19.1.8", "@types/react": "^19.0.12",
"@types/react-dom": "^19.1.6", "@types/react-dom": "^19.0.4",
"@vitejs/plugin-react": "^4.6.0", "@vitejs/plugin-react": "^4.3.4",
"eslint": "^9.30.1", "eslint": "^9.25.1",
"eslint-plugin-react-hooks": "^5.2.0", "eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-react-refresh": "^0.4.20", "eslint-plugin-react-refresh": "^0.4.20",
"globals": "^16.3.0", "globals": "^16.0.0",
"typescript": "^5.8.3", "typescript": "^5.8.3",
"typescript-eslint": "^8.24.1", "typescript-eslint": "^8.24.1",
"vite": "^6.3.5" "vite": "^6.2.3"
} }
} }

@ -36,9 +36,9 @@ dependencies = [
[[package]] [[package]]
name = "actix-http" name = "actix-http"
version = "3.11.0" version = "3.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44dfe5c9e0004c623edc65391dfd51daa201e7e30ebd9c9bedf873048ec32bc2" checksum = "0fa882656b67966045e4152c634051e70346939fced7117d5f0b52146a7c74c9"
dependencies = [ dependencies = [
"actix-codec", "actix-codec",
"actix-rt", "actix-rt",
@ -64,7 +64,7 @@ dependencies = [
"mime", "mime",
"percent-encoding", "percent-encoding",
"pin-project-lite", "pin-project-lite",
"rand 0.9.1", "rand 0.9.0",
"sha1", "sha1",
"smallvec", "smallvec",
"tokio", "tokio",
@ -159,9 +159,9 @@ dependencies = [
[[package]] [[package]]
name = "actix-server" name = "actix-server"
version = "2.6.0" version = "2.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a65064ea4a457eaf07f2fba30b4c695bf43b721790e9530d26cb6f9019ff7502" checksum = "6398974fd4284f4768af07965701efbbb5fdc0616bff20cade1bb14b77675e24"
dependencies = [ dependencies = [
"actix-rt", "actix-rt",
"actix-service", "actix-service",
@ -196,9 +196,9 @@ dependencies = [
[[package]] [[package]]
name = "actix-web" name = "actix-web"
version = "4.11.0" version = "4.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a597b77b5c6d6a1e1097fddde329a83665e25c5437c696a3a9a4aa514a614dea" checksum = "f2e3b15b3dc6c6ed996e4032389e9849d4ab002b1e92fbfe85b5f307d1479b4d"
dependencies = [ dependencies = [
"actix-codec", "actix-codec",
"actix-http", "actix-http",
@ -403,6 +403,12 @@ dependencies = [
"derive_arbitrary", "derive_arbitrary",
] ]
[[package]]
name = "arc-swap"
version = "1.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69f7f8c3906b62b754cd5326047894316021dcfe5a194c8ea52bdd94934a3457"
[[package]] [[package]]
name = "arg_enum_proc_macro" name = "arg_enum_proc_macro"
version = "0.3.4" version = "0.3.4"
@ -591,9 +597,9 @@ dependencies = [
[[package]] [[package]]
name = "brotli" name = "brotli"
version = "8.0.1" version = "7.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9991eea70ea4f293524138648e41ee89b0b2b12ddef3b255effa43c8056e0e0d" checksum = "cc97b8f16f944bba54f0433f07e30be199b6dc2bd25937444bbad560bcea29bd"
dependencies = [ dependencies = [
"alloc-no-stdlib", "alloc-no-stdlib",
"alloc-stdlib", "alloc-stdlib",
@ -602,9 +608,9 @@ dependencies = [
[[package]] [[package]]
name = "brotli-decompressor" name = "brotli-decompressor"
version = "5.0.0" version = "4.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "874bb8112abecc98cbd6d81ea4fa7e94fb9449648c93cc89aa40c81c24d7de03" checksum = "74fa05ad7d803d413eb8380983b092cbbaf9a85f151b871360e7b00cd7060b37"
dependencies = [ dependencies = [
"alloc-no-stdlib", "alloc-no-stdlib",
"alloc-stdlib", "alloc-stdlib",
@ -703,9 +709,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]] [[package]]
name = "chrono" name = "chrono"
version = "0.4.41" version = "0.4.40"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c469d952047f47f91b68d1cba3f10d63c11d73e4636f24f08daf0278abf01c4d" checksum = "1a7964611d71df112cb1730f2ee67324fcf4d0fc6606acbbe9bfe06df124637c"
dependencies = [ dependencies = [
"android-tzdata", "android-tzdata",
"iana-time-zone", "iana-time-zone",
@ -738,9 +744,9 @@ dependencies = [
[[package]] [[package]]
name = "clap" name = "clap"
version = "4.5.41" version = "4.5.35"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be92d32e80243a54711e5d7ce823c35c41c9d929dc4ab58e1276f625841aadf9" checksum = "d8aa86934b44c19c50f87cc2790e19f54f7a67aedb64101c2e1a2e5ecfb73944"
dependencies = [ dependencies = [
"clap_builder", "clap_builder",
"clap_derive", "clap_derive",
@ -748,9 +754,9 @@ dependencies = [
[[package]] [[package]]
name = "clap_builder" name = "clap_builder"
version = "4.5.41" version = "4.5.35"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "707eab41e9622f9139419d573eca0900137718000c517d47da73045f54331c3d" checksum = "2414dbb2dd0695280da6ea9261e327479e9d37b0630f6b53ba2a11c60c679fd9"
dependencies = [ dependencies = [
"anstream", "anstream",
"anstyle", "anstyle",
@ -760,9 +766,9 @@ dependencies = [
[[package]] [[package]]
name = "clap_derive" name = "clap_derive"
version = "4.5.41" version = "4.5.32"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef4f52386a59ca4c860f7393bcf8abd8dfd91ecccc0f774635ff68e92eeef491" checksum = "09176aae279615badda0765c0c0b3f6ed53f4709118af73cf4655d85d1530cd7"
dependencies = [ dependencies = [
"heck", "heck",
"proc-macro2", "proc-macro2",
@ -1050,9 +1056,9 @@ dependencies = [
[[package]] [[package]]
name = "diesel" name = "diesel"
version = "2.2.11" version = "2.2.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a917a9209950404d5be011c81d081a2692a822f73c3d6af586f0cab5ff50f614" checksum = "34d3950690ba3a6910126162b47e775e203006d4242a15de912bec6c0a695153"
dependencies = [ dependencies = [
"bitflags 2.9.0", "bitflags 2.9.0",
"byteorder", "byteorder",
@ -1160,12 +1166,6 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "dyn-clone"
version = "1.0.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c7a8fb8a9fbf66c1f703fe16184d10ca0ee9d23be5b4436400408ba54a95005"
[[package]] [[package]]
name = "either" name = "either"
version = "1.15.0" version = "1.15.0"
@ -1443,7 +1443,7 @@ dependencies = [
"log", "log",
"mailchecker", "mailchecker",
"mime_guess", "mime_guess",
"rand 0.9.1", "rand 0.9.0",
"redis", "redis",
"rust-s3", "rust-s3",
"rust_iso3166", "rust_iso3166",
@ -2066,17 +2066,6 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "io-uring"
version = "0.7.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b86e202f00093dcba4275d4636b93ef9dd75d025ae560d2521b45ea28ab49013"
dependencies = [
"bitflags 2.9.0",
"cfg-if",
"libc",
]
[[package]] [[package]]
name = "ipnet" name = "ipnet"
version = "2.11.0" version = "2.11.0"
@ -2207,9 +2196,9 @@ checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8"
[[package]] [[package]]
name = "lettre" name = "lettre"
version = "0.11.17" version = "0.11.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb2a0354e9ece2fcdcf9fa53417f6de587230c0c248068eb058fa26c4a753179" checksum = "759bc2b8eabb6a30b235d6f716f7f36479f4b38cbe65b8747aefee51f89e8437"
dependencies = [ dependencies = [
"base64", "base64",
"chumsky", "chumsky",
@ -2915,12 +2904,13 @@ dependencies = [
[[package]] [[package]]
name = "rand" name = "rand"
version = "0.9.1" version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9fbfd9d094a40bf3ae768db9361049ace4c0e04a4fd6b359518bd7b73a73dd97" checksum = "3779b94aeb87e8bd4e834cee3650289ee9e0d5677f976ecdb6d219e5f4f6cd94"
dependencies = [ dependencies = [
"rand_chacha 0.9.0", "rand_chacha 0.9.0",
"rand_core 0.9.3", "rand_core 0.9.3",
"zerocopy 0.8.24",
] ]
[[package]] [[package]]
@ -3033,10 +3023,11 @@ dependencies = [
[[package]] [[package]]
name = "redis" name = "redis"
version = "0.32.3" version = "0.29.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f0f6a8c53351d89a3869a703459995a0bcadcfa846002707fbc7e5cca235c4a" checksum = "1bc42f3a12fd4408ce64d8efef67048a924e543bd35c6591c0447fda9054695f"
dependencies = [ dependencies = [
"arc-swap",
"combine", "combine",
"itoa", "itoa",
"num-bigint", "num-bigint",
@ -3067,26 +3058,6 @@ dependencies = [
"thiserror 1.0.69", "thiserror 1.0.69",
] ]
[[package]]
name = "ref-cast"
version = "1.0.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4a0ae411dbe946a674d89546582cea4ba2bb8defac896622d6496f14c23ba5cf"
dependencies = [
"ref-cast-impl",
]
[[package]]
name = "ref-cast-impl"
version = "1.0.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1165225c21bff1f3bbce98f5a1f889949bc902d3575308cc7b0de30b4f6d27c7"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]] [[package]]
name = "regex" name = "regex"
version = "1.11.1" version = "1.11.1"
@ -3351,30 +3322,6 @@ dependencies = [
"windows-sys 0.59.0", "windows-sys 0.59.0",
] ]
[[package]]
name = "schemars"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4cd191f9397d57d581cddd31014772520aa448f65ef991055d7f61582c65165f"
dependencies = [
"dyn-clone",
"ref-cast",
"serde",
"serde_json",
]
[[package]]
name = "schemars"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "82d20c4491bc164fa2f6c5d44565947a52ad80b9505d8e36f8d54c27c739fcd0"
dependencies = [
"dyn-clone",
"ref-cast",
"serde",
"serde_json",
]
[[package]] [[package]]
name = "scopeguard" name = "scopeguard"
version = "1.2.0" version = "1.2.0"
@ -3474,17 +3421,15 @@ dependencies = [
[[package]] [[package]]
name = "serde_with" name = "serde_with"
version = "3.14.0" version = "3.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2c45cd61fefa9db6f254525d46e392b852e0e61d9a1fd36e5bd183450a556d5" checksum = "d6b6f7f2fcb69f747921f79f3926bd1e203fce4fef62c268dd3abfb6d86029aa"
dependencies = [ dependencies = [
"base64", "base64",
"chrono", "chrono",
"hex", "hex",
"indexmap 1.9.3", "indexmap 1.9.3",
"indexmap 2.8.0", "indexmap 2.8.0",
"schemars 0.9.0",
"schemars 1.0.4",
"serde", "serde",
"serde_derive", "serde_derive",
"serde_json", "serde_json",
@ -3494,9 +3439,9 @@ dependencies = [
[[package]] [[package]]
name = "serde_with_macros" name = "serde_with_macros"
version = "3.14.0" version = "3.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "de90945e6565ce0d9a25098082ed4ee4002e047cb59892c318d66821e14bb30f" checksum = "8d00caa5193a3c8362ac2b73be6b9e768aa5a4b2f721d8f4b339600c3cb51f8e"
dependencies = [ dependencies = [
"darling", "darling",
"proc-macro2", "proc-macro2",
@ -3523,9 +3468,9 @@ checksum = "bbfa15b3dddfee50a0fff136974b3e1bde555604ba463834a7eb7deb6417705d"
[[package]] [[package]]
name = "sha2" name = "sha2"
version = "0.10.9" version = "0.10.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"cpufeatures", "cpufeatures",
@ -3839,19 +3784,17 @@ dependencies = [
[[package]] [[package]]
name = "tokio" name = "tokio"
version = "1.46.1" version = "1.44.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0cc3a2344dafbe23a245241fe8b09735b521110d30fcefbbd5feb1797ca35d17" checksum = "f382da615b842244d4b8738c82ed1275e6c5dd90c459a30941cd07080b06c91a"
dependencies = [ dependencies = [
"backtrace", "backtrace",
"bytes", "bytes",
"io-uring",
"libc", "libc",
"mio", "mio",
"parking_lot", "parking_lot",
"pin-project-lite", "pin-project-lite",
"signal-hook-registry", "signal-hook-registry",
"slab",
"socket2", "socket2",
"windows-sys 0.52.0", "windows-sys 0.52.0",
] ]

@ -8,30 +8,30 @@ edition = "2024"
[dependencies] [dependencies]
log = "0.4.27" log = "0.4.27"
env_logger = "0.11.8" env_logger = "0.11.8"
clap = { version = "4.5.41", features = ["derive", "env"] } clap = { version = "4.5.35", features = ["derive", "env"] }
lazy_static = "1.5.0" lazy_static = "1.5.0"
lazy-regex = "3.4.1" lazy-regex = "3.4.1"
anyhow = "1.0.98" anyhow = "1.0.98"
actix-web = "4.11.0" actix-web = "4.10.2"
actix-cors = "0.7.1" actix-cors = "0.7.1"
actix-multipart = "0.7.2" actix-multipart = "0.7.2"
actix-remote-ip = "0.1.0" actix-remote-ip = "0.1.0"
futures-util = "0.3.31" futures-util = "0.3.30"
diesel = { version = "2.2.11", features = ["postgres"] } diesel = { version = "2.2.9", features = ["postgres"] }
diesel_migrations = "2.2.0" diesel_migrations = "2.2.0"
serde = { version = "1.0.219", features = ["derive"] } serde = { version = "1.0.219", features = ["derive"] }
serde_json = "1.0.140" serde_json = "1.0.140"
mailchecker = "6.0.17" mailchecker = "6.0.17"
redis = "0.32.3" redis = "0.29.5"
lettre = "0.11.17" lettre = "0.11.15"
rand = "0.9.1" rand = "0.9.0"
bcrypt = "0.17.0" bcrypt = "0.17.0"
light-openid = "1.0.4" light-openid = "1.0.4"
thiserror = "2.0.12" thiserror = "2.0.12"
serde_with = "3.14.0" serde_with = "3.12.0"
rust_iso3166 = "0.1.14" rust_iso3166 = "0.1.14"
rust-s3 = "0.35.1" rust-s3 = "0.35.1"
sha2 = "0.10.9" sha2 = "0.10.8"
image = "0.25.6" image = "0.25.6"
uuid = { version = "1.16.0", features = ["v4"] } uuid = { version = "1.16.0", features = ["v4"] }
httpdate = "1.0.3" httpdate = "1.0.3"
@ -40,4 +40,4 @@ mime_guess = "2.0.5"
tempfile = "3.19.1" tempfile = "3.19.1"
base64 = "0.22.1" base64 = "0.22.1"
ical = { version = "0.11.0", features = ["generator", "ical", "vcard"] } ical = { version = "0.11.0", features = ["generator", "ical", "vcard"] }
chrono = "0.4.41" chrono = "0.4.40"

@ -21,7 +21,7 @@ where
if POSTGRES_CONNECTION.with(|i| i.borrow().is_none()) { if POSTGRES_CONNECTION.with(|i| i.borrow().is_none()) {
let database_url = AppConfig::get().db_connection_chain(); let database_url = AppConfig::get().db_connection_chain();
let conn = PgConnection::establish(&database_url) let conn = PgConnection::establish(&database_url)
.unwrap_or_else(|_| panic!("Error connecting to {database_url}")); .unwrap_or_else(|_| panic!("Error connecting to {}", database_url));
POSTGRES_CONNECTION.with(|i| *i.borrow_mut() = Some(conn)) POSTGRES_CONNECTION.with(|i| *i.borrow_mut() = Some(conn))
} }
@ -38,7 +38,7 @@ where
POSTGRES_CONNECTION.with(|i| *i.borrow_mut() = None) POSTGRES_CONNECTION.with(|i| *i.borrow_mut() = None)
} }
log::error!("Database query error! {e:?}"); log::error!("Database query error! {:?}", e);
Err(e.into()) Err(e.into())
} }
} }

@ -30,7 +30,7 @@ pub async fn create_bucket_if_required() -> anyhow::Result<()> {
log::warn!("The bucket does not seem to exists, trying to create it!") log::warn!("The bucket does not seem to exists, trying to create it!")
} }
Err(e) => { Err(e) => {
log::error!("Got unexpected error when querying bucket info: {e}"); log::error!("Got unexpected error when querying bucket info: {}", e);
return Err(BucketServiceError::FailedFetchBucketInfo.into()); return Err(BucketServiceError::FailedFetchBucketInfo.into());
} }
} }

@ -79,7 +79,10 @@ pub async fn request_reset_password(
match users_service::get_by_mail(&req.mail).await { match users_service::get_by_mail(&req.mail).await {
Ok(mut user) => users_service::request_reset_password(&mut user).await?, Ok(mut user) => users_service::request_reset_password(&mut user).await?,
Err(e) => { Err(e) => {
log::error!("Could not locate user account {e}! (error silently ignored)"); log::error!(
"Could not locate user account {}! (error silently ignored)",
e
);
} }
} }
@ -119,7 +122,7 @@ pub async fn check_reset_password_token(
RatedAction::CheckResetPasswordTokenFailed, RatedAction::CheckResetPasswordTokenFailed,
) )
.await?; .await?;
log::error!("Password reset token could not be used: {e}"); log::error!("Password reset token could not be used: {}", e);
return Ok(HttpResponse::NotFound().finish()); return Ok(HttpResponse::NotFound().finish());
} }
}; };
@ -153,7 +156,7 @@ pub async fn reset_password(remote_ip: RemoteIP, req: web::Json<ResetPasswordBod
RatedAction::CheckResetPasswordTokenFailed, RatedAction::CheckResetPasswordTokenFailed,
) )
.await?; .await?;
log::error!("Password reset token could not be used: {e}"); log::error!("Password reset token could not be used: {}", e);
return Ok(HttpResponse::NotFound().finish()); return Ok(HttpResponse::NotFound().finish());
} }
}; };
@ -193,7 +196,7 @@ pub async fn password_login(remote_ip: RemoteIP, req: web::Json<PasswordLoginQue
let user = match users_service::get_by_mail(&req.mail).await { let user = match users_service::get_by_mail(&req.mail).await {
Ok(u) => u, Ok(u) => u,
Err(e) => { Err(e) => {
log::error!("Auth failed: could not find account by mail! {e}"); log::error!("Auth failed: could not find account by mail! {}", e);
rate_limiter_service::record_action(remote_ip.0, RatedAction::FailedPasswordLogin) rate_limiter_service::record_action(remote_ip.0, RatedAction::FailedPasswordLogin)
.await?; .await?;
return Ok(HttpResponse::Unauthorized().json("Invalid credentials")); return Ok(HttpResponse::Unauthorized().json("Invalid credentials"));

@ -183,9 +183,9 @@ pub async fn import_family(
} }
if let Err(e) = req_member_data.to_member(member).await { if let Err(e) = req_member_data.to_member(member).await {
log::error!("Error while processing import (member {req_id:?}) - {e}"); log::error!("Error while processing import (member {:?}) - {e}", req_id);
return Ok( return Ok(
HttpResponse::BadRequest().json(format!("Failed to validate member {req_id:?}!")) HttpResponse::BadRequest().json(format!("Failed to validate member {:?}!", req_id))
); );
} }

@ -31,7 +31,7 @@ impl Display for HttpErr {
impl actix_web::error::ResponseError for HttpErr { impl actix_web::error::ResponseError for HttpErr {
fn error_response(&self) -> HttpResponse<BoxBody> { fn error_response(&self) -> HttpResponse<BoxBody> {
log::error!("Error while processing request! {self}"); log::error!("Error while processing request! {}", self);
HttpResponse::InternalServerError().body("Failed to execute request!") HttpResponse::InternalServerError().body("Failed to execute request!")
} }
} }

@ -75,7 +75,7 @@ impl FromRequest for FamilyAndAccommodationInPath {
Self::load_accommodation_from_path(family, accommodation_id) Self::load_accommodation_from_path(family, accommodation_id)
.await .await
.map_err(|e| { .map_err(|e| {
log::error!("Failed to extract accommodation ID from URL! {e}"); log::error!("Failed to extract accommodation ID from URL! {}", e);
actix_web::error::ErrorNotFound("Could not fetch accommodation information!") actix_web::error::ErrorNotFound("Could not fetch accommodation information!")
}) })
}) })

@ -85,7 +85,7 @@ impl FromRequest for FamilyAndAccommodationReservationCalendarInPath {
Self::load_calendar_from_path(family, accommodation_id) Self::load_calendar_from_path(family, accommodation_id)
.await .await
.map_err(|e| { .map_err(|e| {
log::error!("Failed to extract calendar ID from URL! {e}"); log::error!("Failed to extract calendar ID from URL! {}", e);
actix_web::error::ErrorNotFound("Could not fetch calendar information!") actix_web::error::ErrorNotFound("Could not fetch calendar information!")
}) })
}) })

@ -95,7 +95,7 @@ impl FromRequest for FamilyAndAccommodationReservationInPath {
Self::load_accommodation_reservation_from_path(family, reservation_id) Self::load_accommodation_reservation_from_path(family, reservation_id)
.await .await
.map_err(|e| { .map_err(|e| {
log::error!("Failed to extract accommodation ID from URL! {e}"); log::error!("Failed to extract accommodation ID from URL! {}", e);
actix_web::error::ErrorNotFound("Could not fetch accommodation information!") actix_web::error::ErrorNotFound("Could not fetch accommodation information!")
}) })
}) })

@ -71,7 +71,7 @@ impl FromRequest for FamilyAndCoupleInPath {
FamilyAndCoupleInPath::load_couple_from_path(family, couple_id) FamilyAndCoupleInPath::load_couple_from_path(family, couple_id)
.await .await
.map_err(|e| { .map_err(|e| {
log::error!("Failed to extract couple ID from URL! {e}"); log::error!("Failed to extract couple ID from URL! {}", e);
actix_web::error::ErrorNotFound("Could not fetch couple information!") actix_web::error::ErrorNotFound("Could not fetch couple information!")
}) })
}) })

@ -62,7 +62,7 @@ impl FromRequest for FamilyInPath {
FamilyInPath::load_family_from_path(&token, family_id) FamilyInPath::load_family_from_path(&token, family_id)
.await .await
.map_err(|e| { .map_err(|e| {
log::error!("Failed to extract family ID from URL! {e}"); log::error!("Failed to extract family ID from URL! {}", e);
actix_web::error::ErrorNotFound("Could not fetch family information!") actix_web::error::ErrorNotFound("Could not fetch family information!")
}) })
}) })

@ -71,7 +71,7 @@ impl FromRequest for FamilyAndMemberInPath {
FamilyAndMemberInPath::load_member_from_path(family, member_id) FamilyAndMemberInPath::load_member_from_path(family, member_id)
.await .await
.map_err(|e| { .map_err(|e| {
log::error!("Failed to extract member ID from URL! {e}"); log::error!("Failed to extract member ID from URL! {}", e);
actix_web::error::ErrorNotFound("Could not fetch member information!") actix_web::error::ErrorNotFound("Could not fetch member information!")
}) })
}) })

@ -43,7 +43,7 @@ impl User {
.as_deref() .as_deref()
.map(|hash| { .map(|hash| {
bcrypt::verify(password, hash).unwrap_or_else(|e| { bcrypt::verify(password, hash).unwrap_or_else(|e| {
log::error!("Failed to validate password! {e}"); log::error!("Failed to validate password! {}", e);
false false
}) })
}) })

@ -125,13 +125,13 @@ async fn load_token_info(token: &LoginTokenValue) -> anyhow::Result<Option<Login
let token = match user_tokens.iter_mut().find(|t| t.key == key) { let token = match user_tokens.iter_mut().find(|t| t.key == key) {
Some(t) => t, Some(t) => t,
None => { None => {
log::error!("Could not find token for key '{key}' (missing token)"); log::error!("Could not find token for key '{}' (missing token)", key);
return Ok(None); return Ok(None);
} }
}; };
if token.is_expired() { if token.is_expired() {
log::error!("Could not find token for key '{key}' (token expired)"); log::error!("Could not find token for key '{}' (token expired)", key);
return Ok(None); return Ok(None);
} }
@ -169,7 +169,7 @@ impl FromRequest for LoginToken {
let token = match load_token_info(&token).await { let token = match load_token_info(&token).await {
Err(e) => { Err(e) => {
log::error!("Failed to load auth token! {e}"); log::error!("Failed to load auth token! {}", e);
return Err(actix_web::error::ErrorPreconditionFailed( return Err(actix_web::error::ErrorPreconditionFailed(
"Failed to check auth token!", "Failed to check auth token!",
)); ));

@ -27,7 +27,7 @@ pub async fn send_mail<D: Display>(to: &str, subject: &str, body: D) -> anyhow::
let mailer = mailer.build(); let mailer = mailer.build();
mailer.send(&email)?; mailer.send(&email)?;
log::debug!("A mail was sent to {to} (subject = {subject})"); log::debug!("A mail was sent to {} (subject = {})", to, subject);
Ok(()) Ok(())
} }

@ -168,7 +168,7 @@ pub mod loop_detection {
None => false, None => false,
Some(id) => { Some(id) => {
if curr_stack.contains(id) { if curr_stack.contains(id) {
log::debug!("Loop detected! {curr_stack:?}"); log::debug!("Loop detected! {:?}", curr_stack);
return true; return true;
} }

@ -10,6 +10,7 @@ use crate::utils::string_utils::rand_str;
use crate::utils::time_utils::time; use crate::utils::time_utils::time;
use bcrypt::DEFAULT_COST; use bcrypt::DEFAULT_COST;
use diesel::prelude::*; use diesel::prelude::*;
use std::io::ErrorKind;
/// Get the information of a user, by its id /// Get the information of a user, by its id
pub async fn get_by_id(id: UserID) -> anyhow::Result<User> { pub async fn get_by_id(id: UserID) -> anyhow::Result<User> {
@ -24,7 +25,8 @@ pub async fn get_by_mail(mail: &str) -> anyhow::Result<User> {
/// Get the information of a user, by its password reset token /// Get the information of a user, by its password reset token
pub async fn get_by_pwd_reset_token(token: &str) -> anyhow::Result<User> { pub async fn get_by_pwd_reset_token(token: &str) -> anyhow::Result<User> {
if token.is_empty() { if token.is_empty() {
return Err(anyhow::Error::from(std::io::Error::other( return Err(anyhow::Error::from(std::io::Error::new(
ErrorKind::Other,
"Token is empty!", "Token is empty!",
))); )));
} }
@ -44,7 +46,8 @@ pub async fn get_by_pwd_reset_token(token: &str) -> anyhow::Result<User> {
/// Get the information of a user, by its account deletion token /// Get the information of a user, by its account deletion token
pub async fn get_by_account_delete_token(token: &str) -> anyhow::Result<User> { pub async fn get_by_account_delete_token(token: &str) -> anyhow::Result<User> {
if token.is_empty() { if token.is_empty() {
return Err(anyhow::Error::from(std::io::Error::other( return Err(anyhow::Error::from(std::io::Error::new(
ErrorKind::Other,
"Token is empty!", "Token is empty!",
))); )));
} }

@ -5,7 +5,7 @@ pub fn sha256(bytes: &[u8]) -> String {
let mut hasher = Sha256::new(); let mut hasher = Sha256::new();
hasher.update(bytes); hasher.update(bytes);
let h = hasher.finalize(); let h = hasher.finalize();
format!("{h:x}") format!("{:x}", h)
} }
/// Compute hash of a slice of bytes (sha512) /// Compute hash of a slice of bytes (sha512)
@ -13,5 +13,5 @@ pub fn sha512(bytes: &[u8]) -> String {
let mut hasher = Sha512::new(); let mut hasher = Sha512::new();
hasher.update(bytes); hasher.update(bytes);
let h = hasher.finalize(); let h = hasher.finalize();
format!("{h:x}") format!("{:x}", h)
} }