Upgrade to leptos 0.6
This commit is contained in:
parent
901aa2ce01
commit
013fb6391d
479
Cargo.lock
generated
479
Cargo.lock
generated
@ -664,20 +664,6 @@ dependencies = [
|
|||||||
"tokio-util",
|
"tokio-util",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "config"
|
|
||||||
version = "0.13.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "23738e11972c7643e4ec947840fc463b6a571afcd3e735bdfce7d03c7a784aca"
|
|
||||||
dependencies = [
|
|
||||||
"async-trait",
|
|
||||||
"lazy_static",
|
|
||||||
"nom",
|
|
||||||
"pathdiff",
|
|
||||||
"serde",
|
|
||||||
"toml 0.5.11",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "config"
|
name = "config"
|
||||||
version = "0.14.0"
|
version = "0.14.0"
|
||||||
@ -754,22 +740,6 @@ dependencies = [
|
|||||||
"version_check",
|
"version_check",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "core-foundation"
|
|
||||||
version = "0.9.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f"
|
|
||||||
dependencies = [
|
|
||||||
"core-foundation-sys",
|
|
||||||
"libc",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "core-foundation-sys"
|
|
||||||
version = "0.8.6"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cpufeatures"
|
name = "cpufeatures"
|
||||||
version = "0.2.11"
|
version = "0.2.11"
|
||||||
@ -1321,17 +1291,6 @@ dependencies = [
|
|||||||
"itoa",
|
"itoa",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "http-body"
|
|
||||||
version = "0.4.6"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2"
|
|
||||||
dependencies = [
|
|
||||||
"bytes",
|
|
||||||
"http 0.2.11",
|
|
||||||
"pin-project-lite",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "http-range"
|
name = "http-range"
|
||||||
version = "0.1.5"
|
version = "0.1.5"
|
||||||
@ -1350,30 +1309,6 @@ version = "1.0.3"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
|
checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "hyper"
|
|
||||||
version = "0.14.28"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80"
|
|
||||||
dependencies = [
|
|
||||||
"bytes",
|
|
||||||
"futures-channel",
|
|
||||||
"futures-core",
|
|
||||||
"futures-util",
|
|
||||||
"h2",
|
|
||||||
"http 0.2.11",
|
|
||||||
"http-body",
|
|
||||||
"httparse",
|
|
||||||
"httpdate",
|
|
||||||
"itoa",
|
|
||||||
"pin-project-lite",
|
|
||||||
"socket2",
|
|
||||||
"tokio",
|
|
||||||
"tower-service",
|
|
||||||
"tracing",
|
|
||||||
"want",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "icondata"
|
name = "icondata"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
@ -1625,30 +1560,6 @@ version = "0.3.14"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c8573b2b1fb643a372c73b23f4da5f888677feef3305146d68a539250a9bccc7"
|
checksum = "c8573b2b1fb643a372c73b23f4da5f888677feef3305146d68a539250a9bccc7"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "ipnet"
|
|
||||||
version = "2.9.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "itertools"
|
|
||||||
version = "0.10.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473"
|
|
||||||
dependencies = [
|
|
||||||
"either",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "itertools"
|
|
||||||
version = "0.11.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57"
|
|
||||||
dependencies = [
|
|
||||||
"either",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "itertools"
|
name = "itertools"
|
||||||
version = "0.12.1"
|
version = "0.12.1"
|
||||||
@ -1696,17 +1607,17 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "leptos"
|
name = "leptos"
|
||||||
version = "0.5.4"
|
version = "0.6.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9d02b78d6e38acf8199426058a0d8c4030835d84a4ee16147df25be7fed707e0"
|
checksum = "56d079555ff18158a1ed28d2a8ac529b4cb5904490384064346eb2d321addde6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"leptos_config 0.5.4",
|
"leptos_config",
|
||||||
"leptos_dom 0.5.4",
|
"leptos_dom",
|
||||||
"leptos_macro 0.5.4",
|
"leptos_macro",
|
||||||
"leptos_reactive 0.5.4",
|
"leptos_reactive",
|
||||||
"leptos_server 0.5.4",
|
"leptos_server",
|
||||||
"server_fn 0.5.4",
|
"server_fn",
|
||||||
"tracing",
|
"tracing",
|
||||||
"typed-builder",
|
"typed-builder",
|
||||||
"typed-builder-macro",
|
"typed-builder-macro",
|
||||||
@ -1715,100 +1626,40 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "leptos"
|
name = "leptos_actix"
|
||||||
version = "0.6.9"
|
version = "0.6.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "56d079555ff18158a1ed28d2a8ac529b4cb5904490384064346eb2d321addde6"
|
checksum = "9edb4789a15864a26d695038f42dcdf1d1c32d3a1f537751ce177c97f4f5e3dd"
|
||||||
dependencies = [
|
|
||||||
"cfg-if",
|
|
||||||
"leptos_config 0.6.9",
|
|
||||||
"leptos_dom 0.6.9",
|
|
||||||
"leptos_macro 0.6.9",
|
|
||||||
"leptos_reactive 0.6.9",
|
|
||||||
"leptos_server 0.6.9",
|
|
||||||
"server_fn 0.6.9",
|
|
||||||
"tracing",
|
|
||||||
"typed-builder",
|
|
||||||
"typed-builder-macro",
|
|
||||||
"web-sys",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "leptos_actix"
|
|
||||||
version = "0.5.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "67b2b118a031de24b39be9ef2dcfa03e7e255e98d06a8aa2c53f220155424cf1"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"actix-http",
|
"actix-http",
|
||||||
"actix-web",
|
"actix-web",
|
||||||
"futures",
|
"futures",
|
||||||
"leptos 0.5.4",
|
"leptos",
|
||||||
"leptos_integration_utils",
|
"leptos_integration_utils",
|
||||||
|
"leptos_macro",
|
||||||
"leptos_meta",
|
"leptos_meta",
|
||||||
"leptos_router",
|
"leptos_router",
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
"regex",
|
"regex",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
|
"server_fn",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tracing",
|
"tracing",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "leptos_config"
|
|
||||||
version = "0.5.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "afcaa5db5b22b794b624e14ffe2aefae215b2d21c60a230ae2d06fe21ae5da64"
|
|
||||||
dependencies = [
|
|
||||||
"config 0.13.4",
|
|
||||||
"regex",
|
|
||||||
"serde",
|
|
||||||
"thiserror",
|
|
||||||
"typed-builder",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "leptos_config"
|
name = "leptos_config"
|
||||||
version = "0.6.9"
|
version = "0.6.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2d80b4ed5f0447996b9a28879002f995d3770687630f568be41307f362f84cb7"
|
checksum = "2d80b4ed5f0447996b9a28879002f995d3770687630f568be41307f362f84cb7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"config 0.14.0",
|
"config",
|
||||||
"regex",
|
"regex",
|
||||||
"serde",
|
"serde",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"typed-builder",
|
"typed-builder",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "leptos_dom"
|
|
||||||
version = "0.5.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "af459b63567e8e9c921ecbe7863732dc8dcb7874eaad6826b7d3778a53ec0ea6"
|
|
||||||
dependencies = [
|
|
||||||
"async-recursion",
|
|
||||||
"cfg-if",
|
|
||||||
"drain_filter_polyfill",
|
|
||||||
"futures",
|
|
||||||
"getrandom",
|
|
||||||
"html-escape",
|
|
||||||
"indexmap",
|
|
||||||
"itertools 0.10.5",
|
|
||||||
"js-sys",
|
|
||||||
"leptos_reactive 0.5.4",
|
|
||||||
"once_cell",
|
|
||||||
"pad-adapter",
|
|
||||||
"paste",
|
|
||||||
"rustc-hash",
|
|
||||||
"serde",
|
|
||||||
"serde_json",
|
|
||||||
"server_fn 0.5.4",
|
|
||||||
"smallvec",
|
|
||||||
"tracing",
|
|
||||||
"wasm-bindgen",
|
|
||||||
"wasm-bindgen-futures",
|
|
||||||
"web-sys",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "leptos_dom"
|
name = "leptos_dom"
|
||||||
version = "0.6.9"
|
version = "0.6.9"
|
||||||
@ -1822,16 +1673,16 @@ dependencies = [
|
|||||||
"getrandom",
|
"getrandom",
|
||||||
"html-escape",
|
"html-escape",
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"itertools 0.12.1",
|
"itertools",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"leptos_reactive 0.6.9",
|
"leptos_reactive",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"pad-adapter",
|
"pad-adapter",
|
||||||
"paste",
|
"paste",
|
||||||
"rustc-hash",
|
"rustc-hash",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"server_fn 0.6.9",
|
"server_fn",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
"tracing",
|
"tracing",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
@ -1839,24 +1690,6 @@ dependencies = [
|
|||||||
"web-sys",
|
"web-sys",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "leptos_hot_reload"
|
|
||||||
version = "0.5.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "4ea60376eb80a24b3ab082612d62211e3ea0fc4dee132f7ff34d5fa5a5108cd2"
|
|
||||||
dependencies = [
|
|
||||||
"anyhow",
|
|
||||||
"camino",
|
|
||||||
"indexmap",
|
|
||||||
"parking_lot",
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"rstml",
|
|
||||||
"serde",
|
|
||||||
"syn 2.0.48",
|
|
||||||
"walkdir",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "leptos_hot_reload"
|
name = "leptos_hot_reload"
|
||||||
version = "0.6.9"
|
version = "0.6.9"
|
||||||
@ -1885,48 +1718,25 @@ dependencies = [
|
|||||||
"encoding_rs",
|
"encoding_rs",
|
||||||
"icondata_core",
|
"icondata_core",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"leptos 0.6.9",
|
"leptos",
|
||||||
"log",
|
"log",
|
||||||
"paste",
|
"paste",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "leptos_integration_utils"
|
name = "leptos_integration_utils"
|
||||||
version = "0.5.4"
|
version = "0.6.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c2dbbd7d721bcdd9aa7b20987063de41314c836a3ac67e263ca489857e337dec"
|
checksum = "ff00799857159434d31b6bd1898e21c63f69f39289621da5a554fcab1c3e7300"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"futures",
|
"futures",
|
||||||
"leptos 0.5.4",
|
"leptos",
|
||||||
"leptos_config 0.5.4",
|
"leptos_config",
|
||||||
"leptos_hot_reload 0.5.4",
|
"leptos_hot_reload",
|
||||||
"leptos_meta",
|
"leptos_meta",
|
||||||
"tracing",
|
"tracing",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "leptos_macro"
|
|
||||||
version = "0.5.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a7e96f4c450f4b5e2ccb135c2b1328890f911ca4ee89da9ed6d582df929e6cb5"
|
|
||||||
dependencies = [
|
|
||||||
"attribute-derive",
|
|
||||||
"cfg-if",
|
|
||||||
"convert_case 0.6.0",
|
|
||||||
"html-escape",
|
|
||||||
"itertools 0.11.0",
|
|
||||||
"leptos_hot_reload 0.5.4",
|
|
||||||
"prettyplease",
|
|
||||||
"proc-macro-error",
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"rstml",
|
|
||||||
"server_fn_macro 0.5.4",
|
|
||||||
"syn 2.0.48",
|
|
||||||
"tracing",
|
|
||||||
"uuid",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "leptos_macro"
|
name = "leptos_macro"
|
||||||
version = "0.6.9"
|
version = "0.6.9"
|
||||||
@ -1937,14 +1747,14 @@ dependencies = [
|
|||||||
"cfg-if",
|
"cfg-if",
|
||||||
"convert_case 0.6.0",
|
"convert_case 0.6.0",
|
||||||
"html-escape",
|
"html-escape",
|
||||||
"itertools 0.12.1",
|
"itertools",
|
||||||
"leptos_hot_reload 0.6.9",
|
"leptos_hot_reload",
|
||||||
"prettyplease",
|
"prettyplease",
|
||||||
"proc-macro-error",
|
"proc-macro-error",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"rstml",
|
"rstml",
|
||||||
"server_fn_macro 0.6.9",
|
"server_fn_macro",
|
||||||
"syn 2.0.48",
|
"syn 2.0.48",
|
||||||
"tracing",
|
"tracing",
|
||||||
"uuid",
|
"uuid",
|
||||||
@ -1952,46 +1762,18 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "leptos_meta"
|
name = "leptos_meta"
|
||||||
version = "0.5.4"
|
version = "0.6.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "983bbf829598d275b01e96bd9fca71e4739dd7b9fdf69cb8898b30ebfb124332"
|
checksum = "12b9dac59a2f88f5235dbe17cfa81b738a6f47238a64e4f23b921f1a90a9bf11"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"leptos 0.5.4",
|
"leptos",
|
||||||
"tracing",
|
"tracing",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
"web-sys",
|
"web-sys",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "leptos_reactive"
|
|
||||||
version = "0.5.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "22207568e096ac153ba8da68635e3136c1ec614ea9012736fa861c05bfb2eeff"
|
|
||||||
dependencies = [
|
|
||||||
"base64 0.21.5",
|
|
||||||
"cfg-if",
|
|
||||||
"futures",
|
|
||||||
"indexmap",
|
|
||||||
"js-sys",
|
|
||||||
"paste",
|
|
||||||
"pin-project",
|
|
||||||
"rkyv",
|
|
||||||
"rustc-hash",
|
|
||||||
"self_cell",
|
|
||||||
"serde",
|
|
||||||
"serde-wasm-bindgen 0.5.0",
|
|
||||||
"serde_json",
|
|
||||||
"slotmap",
|
|
||||||
"thiserror",
|
|
||||||
"tokio",
|
|
||||||
"tracing",
|
|
||||||
"wasm-bindgen",
|
|
||||||
"wasm-bindgen-futures",
|
|
||||||
"web-sys",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "leptos_reactive"
|
name = "leptos_reactive"
|
||||||
version = "0.6.9"
|
version = "0.6.9"
|
||||||
@ -2002,32 +1784,37 @@ dependencies = [
|
|||||||
"cfg-if",
|
"cfg-if",
|
||||||
"futures",
|
"futures",
|
||||||
"indexmap",
|
"indexmap",
|
||||||
|
"js-sys",
|
||||||
"paste",
|
"paste",
|
||||||
"pin-project",
|
"pin-project",
|
||||||
|
"rkyv",
|
||||||
"rustc-hash",
|
"rustc-hash",
|
||||||
"self_cell",
|
"self_cell",
|
||||||
"serde",
|
"serde",
|
||||||
"serde-wasm-bindgen 0.6.5",
|
"serde-wasm-bindgen",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"slotmap",
|
"slotmap",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
|
"tokio",
|
||||||
"tracing",
|
"tracing",
|
||||||
|
"wasm-bindgen",
|
||||||
"wasm-bindgen-futures",
|
"wasm-bindgen-futures",
|
||||||
|
"web-sys",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "leptos_router"
|
name = "leptos_router"
|
||||||
version = "0.5.4"
|
version = "0.6.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c1a2ff8b8e8ae8b17efd8be2a407f7f83ed57c5243f70f2d03e6635f9ff61848"
|
checksum = "9460a5dc184fa05d8eb635b687ad3220d02d2d23d6f49c3bf146aa71e427f423"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cached",
|
"cached",
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"gloo-net 0.2.6",
|
"gloo-net 0.2.6",
|
||||||
"itertools 0.11.0",
|
"itertools",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"leptos 0.5.4",
|
"leptos",
|
||||||
"leptos_integration_utils",
|
"leptos_integration_utils",
|
||||||
"leptos_meta",
|
"leptos_meta",
|
||||||
"linear-map",
|
"linear-map",
|
||||||
@ -2035,6 +1822,7 @@ dependencies = [
|
|||||||
"once_cell",
|
"once_cell",
|
||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
"regex",
|
"regex",
|
||||||
|
"send_wrapper",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"serde_qs",
|
"serde_qs",
|
||||||
@ -2046,22 +1834,6 @@ dependencies = [
|
|||||||
"web-sys",
|
"web-sys",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "leptos_server"
|
|
||||||
version = "0.5.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "272d018a5adf33d10ee57e6f0f83dccc305c68613cd207e8a653aeebd4cd5b4f"
|
|
||||||
dependencies = [
|
|
||||||
"inventory",
|
|
||||||
"lazy_static",
|
|
||||||
"leptos_macro 0.5.4",
|
|
||||||
"leptos_reactive 0.5.4",
|
|
||||||
"serde",
|
|
||||||
"server_fn 0.5.4",
|
|
||||||
"thiserror",
|
|
||||||
"tracing",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "leptos_server"
|
name = "leptos_server"
|
||||||
version = "0.6.9"
|
version = "0.6.9"
|
||||||
@ -2070,10 +1842,10 @@ checksum = "654b6ff6a24e79977641b5214452373b1e12fdf4c8a563fadf656c139694b4b9"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"inventory",
|
"inventory",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"leptos_macro 0.6.9",
|
"leptos_macro",
|
||||||
"leptos_reactive 0.6.9",
|
"leptos_reactive",
|
||||||
"serde",
|
"serde",
|
||||||
"server_fn 0.6.9",
|
"server_fn",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"tracing",
|
"tracing",
|
||||||
]
|
]
|
||||||
@ -2101,7 +1873,7 @@ dependencies = [
|
|||||||
"http 0.2.11",
|
"http 0.2.11",
|
||||||
"icondata",
|
"icondata",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"leptos 0.5.4",
|
"leptos",
|
||||||
"leptos_actix",
|
"leptos_actix",
|
||||||
"leptos_icons",
|
"leptos_icons",
|
||||||
"leptos_meta",
|
"leptos_meta",
|
||||||
@ -2708,41 +2480,6 @@ dependencies = [
|
|||||||
"bytecheck",
|
"bytecheck",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "reqwest"
|
|
||||||
version = "0.11.23"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "37b1ae8d9ac08420c66222fb9096fc5de435c3c48542bc5336c51892cffafb41"
|
|
||||||
dependencies = [
|
|
||||||
"base64 0.21.5",
|
|
||||||
"bytes",
|
|
||||||
"encoding_rs",
|
|
||||||
"futures-core",
|
|
||||||
"futures-util",
|
|
||||||
"h2",
|
|
||||||
"http 0.2.11",
|
|
||||||
"http-body",
|
|
||||||
"hyper",
|
|
||||||
"ipnet",
|
|
||||||
"js-sys",
|
|
||||||
"log",
|
|
||||||
"mime",
|
|
||||||
"once_cell",
|
|
||||||
"percent-encoding",
|
|
||||||
"pin-project-lite",
|
|
||||||
"serde",
|
|
||||||
"serde_json",
|
|
||||||
"serde_urlencoded",
|
|
||||||
"system-configuration",
|
|
||||||
"tokio",
|
|
||||||
"tower-service",
|
|
||||||
"url",
|
|
||||||
"wasm-bindgen",
|
|
||||||
"wasm-bindgen-futures",
|
|
||||||
"web-sys",
|
|
||||||
"winreg",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rkyv"
|
name = "rkyv"
|
||||||
version = "0.7.43"
|
version = "0.7.43"
|
||||||
@ -2873,17 +2610,6 @@ dependencies = [
|
|||||||
"serde_derive",
|
"serde_derive",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "serde-wasm-bindgen"
|
|
||||||
version = "0.5.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "f3b143e2833c57ab9ad3ea280d21fd34e285a42837aeb0ee301f4f41890fa00e"
|
|
||||||
dependencies = [
|
|
||||||
"js-sys",
|
|
||||||
"serde",
|
|
||||||
"wasm-bindgen",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde-wasm-bindgen"
|
name = "serde-wasm-bindgen"
|
||||||
version = "0.6.5"
|
version = "0.6.5"
|
||||||
@ -2958,37 +2684,13 @@ dependencies = [
|
|||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "server_fn"
|
|
||||||
version = "0.5.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "cfed18dfcc8d9004579c40482c3419c07f60ffb9c5b250542edca99f508b0ce9"
|
|
||||||
dependencies = [
|
|
||||||
"ciborium",
|
|
||||||
"const_format",
|
|
||||||
"gloo-net 0.2.6",
|
|
||||||
"inventory",
|
|
||||||
"js-sys",
|
|
||||||
"lazy_static",
|
|
||||||
"once_cell",
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"reqwest",
|
|
||||||
"serde",
|
|
||||||
"serde_json",
|
|
||||||
"serde_qs",
|
|
||||||
"server_fn_macro_default 0.5.4",
|
|
||||||
"syn 2.0.48",
|
|
||||||
"thiserror",
|
|
||||||
"xxhash-rust",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "server_fn"
|
name = "server_fn"
|
||||||
version = "0.6.9"
|
version = "0.6.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2955da1dc5fcd970c182ebf1089af6c5f19051e1f286a21f7b96490a49b7a531"
|
checksum = "2955da1dc5fcd970c182ebf1089af6c5f19051e1f286a21f7b96490a49b7a531"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"actix-web",
|
||||||
"bytes",
|
"bytes",
|
||||||
"ciborium",
|
"ciborium",
|
||||||
"const_format",
|
"const_format",
|
||||||
@ -2996,13 +2698,14 @@ dependencies = [
|
|||||||
"futures",
|
"futures",
|
||||||
"gloo-net 0.5.0",
|
"gloo-net 0.5.0",
|
||||||
"http 1.1.0",
|
"http 1.1.0",
|
||||||
|
"inventory",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"send_wrapper",
|
"send_wrapper",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"serde_qs",
|
"serde_qs",
|
||||||
"server_fn_macro_default 0.6.9",
|
"server_fn_macro_default",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"url",
|
"url",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
@ -3012,21 +2715,6 @@ dependencies = [
|
|||||||
"xxhash-rust",
|
"xxhash-rust",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "server_fn_macro"
|
|
||||||
version = "0.5.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "0b70ae8e22546ba85500391b36c08e3fba64871be8a26557a3663a8e08acb56f"
|
|
||||||
dependencies = [
|
|
||||||
"const_format",
|
|
||||||
"proc-macro-error",
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"serde",
|
|
||||||
"syn 2.0.48",
|
|
||||||
"xxhash-rust",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "server_fn_macro"
|
name = "server_fn_macro"
|
||||||
version = "0.6.9"
|
version = "0.6.9"
|
||||||
@ -3041,23 +2729,13 @@ dependencies = [
|
|||||||
"xxhash-rust",
|
"xxhash-rust",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "server_fn_macro_default"
|
|
||||||
version = "0.5.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "7256ba61dfadb220598db418376e7bc2a34b96df36c4dc48f24ffe161810fc0b"
|
|
||||||
dependencies = [
|
|
||||||
"server_fn_macro 0.5.4",
|
|
||||||
"syn 2.0.48",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "server_fn_macro_default"
|
name = "server_fn_macro_default"
|
||||||
version = "0.6.9"
|
version = "0.6.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "060af1def72353a779fcc184c53e1965d3055a38b9e827f2259b2bff2d9c371e"
|
checksum = "060af1def72353a779fcc184c53e1965d3055a38b9e827f2259b2bff2d9c371e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"server_fn_macro 0.6.9",
|
"server_fn_macro",
|
||||||
"syn 2.0.48",
|
"syn 2.0.48",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -3179,27 +2857,6 @@ dependencies = [
|
|||||||
"syn 2.0.48",
|
"syn 2.0.48",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "system-configuration"
|
|
||||||
version = "0.5.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags 1.3.2",
|
|
||||||
"core-foundation",
|
|
||||||
"system-configuration-sys",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "system-configuration-sys"
|
|
||||||
version = "0.5.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9"
|
|
||||||
dependencies = [
|
|
||||||
"core-foundation-sys",
|
|
||||||
"libc",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tap"
|
name = "tap"
|
||||||
version = "1.0.1"
|
version = "1.0.1"
|
||||||
@ -3314,15 +2971,6 @@ dependencies = [
|
|||||||
"tracing",
|
"tracing",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "toml"
|
|
||||||
version = "0.5.11"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234"
|
|
||||||
dependencies = [
|
|
||||||
"serde",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "toml"
|
name = "toml"
|
||||||
version = "0.7.8"
|
version = "0.7.8"
|
||||||
@ -3382,12 +3030,6 @@ dependencies = [
|
|||||||
"winnow 0.6.5",
|
"winnow 0.6.5",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "tower-service"
|
|
||||||
version = "0.3.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tracing"
|
name = "tracing"
|
||||||
version = "0.1.40"
|
version = "0.1.40"
|
||||||
@ -3420,12 +3062,6 @@ dependencies = [
|
|||||||
"once_cell",
|
"once_cell",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "try-lock"
|
|
||||||
version = "0.2.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "typed-builder"
|
name = "typed-builder"
|
||||||
version = "0.18.0"
|
version = "0.18.0"
|
||||||
@ -3552,15 +3188,6 @@ dependencies = [
|
|||||||
"winapi-util",
|
"winapi-util",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "want"
|
|
||||||
version = "0.3.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e"
|
|
||||||
dependencies = [
|
|
||||||
"try-lock",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasi"
|
name = "wasi"
|
||||||
version = "0.11.0+wasi-snapshot-preview1"
|
version = "0.11.0+wasi-snapshot-preview1"
|
||||||
@ -3771,16 +3398,6 @@ dependencies = [
|
|||||||
"memchr",
|
"memchr",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "winreg"
|
|
||||||
version = "0.50.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1"
|
|
||||||
dependencies = [
|
|
||||||
"cfg-if",
|
|
||||||
"windows-sys",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wyz"
|
name = "wyz"
|
||||||
version = "0.5.1"
|
version = "0.5.1"
|
||||||
|
@ -13,10 +13,10 @@ actix-web = { version = "4", optional = true, features = ["macros"] }
|
|||||||
console_error_panic_hook = "0.1"
|
console_error_panic_hook = "0.1"
|
||||||
cfg-if = "1"
|
cfg-if = "1"
|
||||||
http = { version = "0.2", optional = true }
|
http = { version = "0.2", optional = true }
|
||||||
leptos = { version = "0.5", features = ["nightly"] }
|
leptos = { version = "0.6", features = ["nightly"] }
|
||||||
leptos_meta = { version = "0.5", features = ["nightly"] }
|
leptos_meta = { version = "0.6", features = ["nightly"] }
|
||||||
leptos_actix = { version = "0.5", optional = true }
|
leptos_actix = { version = "0.6", optional = true }
|
||||||
leptos_router = { version = "0.5", features = ["nightly"] }
|
leptos_router = { version = "0.6", features = ["nightly"] }
|
||||||
wasm-bindgen = "=0.2.89"
|
wasm-bindgen = "=0.2.89"
|
||||||
leptos_icons = { version = "0.3.0" }
|
leptos_icons = { version = "0.3.0" }
|
||||||
icondata = { version = "0.3.0" }
|
icondata = { version = "0.3.0" }
|
||||||
|
43
src/auth.rs
43
src/auth.rs
@ -1,4 +1,5 @@
|
|||||||
use leptos::*;
|
use leptos::*;
|
||||||
|
use leptos::server_fn::error::NoCustomError;
|
||||||
use crate::models::User;
|
use crate::models::User;
|
||||||
|
|
||||||
/// Create a new user and log them in
|
/// Create a new user and log them in
|
||||||
@ -19,13 +20,17 @@ pub async fn signup(new_user: User) -> Result<(), ServerFnError> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
create_user(&new_user).await
|
create_user(&new_user).await
|
||||||
.map_err(|e| ServerFnError::ServerError(format!("Error creating user: {}", e)))?;
|
.map_err(|e| ServerFnError::<NoCustomError>::ServerError(format!("Error creating user: {}", e)))?;
|
||||||
|
|
||||||
extract(|request: HttpRequest| async move {
|
match extract::<HttpRequest>().await {
|
||||||
Identity::login(&request.extensions(), new_user.username.clone())
|
Ok(request) => {
|
||||||
}).await??;
|
match Identity::login(&request.extensions(), new_user.username.clone()) {
|
||||||
|
Ok(_) => Ok(()),
|
||||||
Ok(())
|
Err(e) => Err(ServerFnError::<NoCustomError>::ServerError(format!("Error logging in user: {}", e))),
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Err(e) => Err(ServerFnError::<NoCustomError>::ServerError(format!("Error getting request: {}", e))),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Log a user in
|
/// Log a user in
|
||||||
@ -39,18 +44,22 @@ pub async fn login(username_or_email: String, password: String) -> Result<bool,
|
|||||||
use leptos_actix::extract;
|
use leptos_actix::extract;
|
||||||
|
|
||||||
let possible_user = validate_user(username_or_email, password).await
|
let possible_user = validate_user(username_or_email, password).await
|
||||||
.map_err(|e| ServerFnError::ServerError(format!("Error validating user: {}", e)))?;
|
.map_err(|e| ServerFnError::<NoCustomError>::ServerError(format!("Error validating user: {}", e)))?;
|
||||||
|
|
||||||
let user = match possible_user {
|
let user = match possible_user {
|
||||||
Some(user) => user,
|
Some(user) => user,
|
||||||
None => return Ok(false)
|
None => return Ok(false)
|
||||||
};
|
};
|
||||||
|
|
||||||
extract(|request: HttpRequest| async move {
|
match extract::<HttpRequest>().await {
|
||||||
Identity::login(&request.extensions(), user.username.clone())
|
Ok(request) => {
|
||||||
}).await??;
|
match Identity::login(&request.extensions(), user.username.clone()) {
|
||||||
|
Ok(_) => Ok(true),
|
||||||
Ok(true)
|
Err(e) => Err(ServerFnError::<NoCustomError>::ServerError(format!("Error logging in user: {}", e))),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Err(e) => Err(ServerFnError::<NoCustomError>::ServerError(format!("Error getting request: {}", e))),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Log a user out
|
/// Log a user out
|
||||||
@ -60,11 +69,11 @@ pub async fn logout() -> Result<(), ServerFnError> {
|
|||||||
use leptos_actix::extract;
|
use leptos_actix::extract;
|
||||||
use actix_identity::Identity;
|
use actix_identity::Identity;
|
||||||
|
|
||||||
extract(|user: Option<Identity>| async move {
|
match extract::<Option<Identity>>().await {
|
||||||
if let Some(user) = user {
|
Ok(Some(user)) => user.logout(),
|
||||||
user.logout();
|
Ok(None) => {},
|
||||||
}
|
Err(e) => return Err(ServerFnError::<NoCustomError>::ServerError(format!("Error getting user: {}", e))),
|
||||||
}).await?;
|
};
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
17
src/users.rs
17
src/users.rs
@ -14,6 +14,7 @@ cfg_if::cfg_if! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
|
use leptos::server_fn::error::NoCustomError;
|
||||||
use crate::models::User;
|
use crate::models::User;
|
||||||
|
|
||||||
/// Get a user from the database by username or email
|
/// Get a user from the database by username or email
|
||||||
@ -26,7 +27,7 @@ pub async fn find_user(username_or_email: String) -> Result<Option<User>, Server
|
|||||||
let db_con = &mut get_db_conn();
|
let db_con = &mut get_db_conn();
|
||||||
let user = users.filter(username.eq(username_or_email.clone())).or_filter(email.eq(username_or_email))
|
let user = users.filter(username.eq(username_or_email.clone())).or_filter(email.eq(username_or_email))
|
||||||
.first::<User>(db_con).optional()
|
.first::<User>(db_con).optional()
|
||||||
.map_err(|e| ServerFnError::ServerError(format!("Error getting user from database: {}", e)))?;
|
.map_err(|e| ServerFnError::<NoCustomError>::ServerError(format!("Error getting user from database: {}", e)))?;
|
||||||
|
|
||||||
Ok(user)
|
Ok(user)
|
||||||
}
|
}
|
||||||
@ -38,11 +39,11 @@ pub async fn create_user(new_user: &User) -> Result<(), ServerFnError> {
|
|||||||
use crate::schema::users::dsl::*;
|
use crate::schema::users::dsl::*;
|
||||||
|
|
||||||
let new_password = new_user.password.clone()
|
let new_password = new_user.password.clone()
|
||||||
.ok_or(ServerFnError::ServerError(format!("No password provided for user {}", new_user.username)))?;
|
.ok_or(ServerFnError::<NoCustomError>::ServerError(format!("No password provided for user {}", new_user.username)))?;
|
||||||
|
|
||||||
let salt = SaltString::generate(&mut OsRng);
|
let salt = SaltString::generate(&mut OsRng);
|
||||||
let password_hash = Pbkdf2.hash_password(new_password.as_bytes(), &salt)
|
let password_hash = Pbkdf2.hash_password(new_password.as_bytes(), &salt)
|
||||||
.map_err(|_| ServerFnError::ServerError("Error hashing password".to_string()))?.to_string();
|
.map_err(|_| ServerFnError::<NoCustomError>::ServerError("Error hashing password".to_string()))?.to_string();
|
||||||
|
|
||||||
let new_user = User {
|
let new_user = User {
|
||||||
password: Some(password_hash),
|
password: Some(password_hash),
|
||||||
@ -52,7 +53,7 @@ pub async fn create_user(new_user: &User) -> Result<(), ServerFnError> {
|
|||||||
let db_con = &mut get_db_conn();
|
let db_con = &mut get_db_conn();
|
||||||
|
|
||||||
diesel::insert_into(users).values(&new_user).execute(db_con)
|
diesel::insert_into(users).values(&new_user).execute(db_con)
|
||||||
.map_err(|e| ServerFnError::ServerError(format!("Error creating user: {}", e)))?;
|
.map_err(|e| ServerFnError::<NoCustomError>::ServerError(format!("Error creating user: {}", e)))?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@ -62,7 +63,7 @@ pub async fn create_user(new_user: &User) -> Result<(), ServerFnError> {
|
|||||||
#[cfg(feature = "ssr")]
|
#[cfg(feature = "ssr")]
|
||||||
pub async fn validate_user(username_or_email: String, password: String) -> Result<Option<User>, ServerFnError> {
|
pub async fn validate_user(username_or_email: String, password: String) -> Result<Option<User>, ServerFnError> {
|
||||||
let db_user = find_user(username_or_email.clone()).await
|
let db_user = find_user(username_or_email.clone()).await
|
||||||
.map_err(|e| ServerFnError::ServerError(format!("Error getting user from database: {}", e)))?;
|
.map_err(|e| ServerFnError::<NoCustomError>::ServerError(format!("Error getting user from database: {}", e)))?;
|
||||||
|
|
||||||
// If the user is not found, return None
|
// If the user is not found, return None
|
||||||
let db_user = match db_user {
|
let db_user = match db_user {
|
||||||
@ -71,10 +72,10 @@ pub async fn validate_user(username_or_email: String, password: String) -> Resul
|
|||||||
};
|
};
|
||||||
|
|
||||||
let db_password = db_user.password.clone()
|
let db_password = db_user.password.clone()
|
||||||
.ok_or(ServerFnError::ServerError(format!("No password found for user {}", db_user.username)))?;
|
.ok_or(ServerFnError::<NoCustomError>::ServerError(format!("No password found for user {}", db_user.username)))?;
|
||||||
|
|
||||||
let password_hash = PasswordHash::new(&db_password)
|
let password_hash = PasswordHash::new(&db_password)
|
||||||
.map_err(|e| ServerFnError::ServerError(format!("Error hashing supplied password: {}", e)))?;
|
.map_err(|e| ServerFnError::<NoCustomError>::ServerError(format!("Error hashing supplied password: {}", e)))?;
|
||||||
|
|
||||||
match Pbkdf2.verify_password(password.as_bytes(), &password_hash) {
|
match Pbkdf2.verify_password(password.as_bytes(), &password_hash) {
|
||||||
Ok(()) => {},
|
Ok(()) => {},
|
||||||
@ -82,7 +83,7 @@ pub async fn validate_user(username_or_email: String, password: String) -> Resul
|
|||||||
return Ok(None);
|
return Ok(None);
|
||||||
},
|
},
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
return Err(ServerFnError::ServerError(format!("Error verifying password: {}", e)));
|
return Err(ServerFnError::<NoCustomError>::ServerError(format!("Error verifying password: {}", e)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user