MCPcopy Create free account
hub / github.com/Rust-Web-Development/code / register

Function register

ch_10/src/routes/authentication.rs:17–35  ·  view source on GitHub ↗
(
    store: Store,
    account: Account,
)

Source from the content-addressed store, hash-verified

15use crate::types::account::{Account, AccountId, Session};
16
17pub async fn register(
18 store: Store,
19 account: Account,
20) -> Result<impl warp::Reply, warp::Rejection> {
21 let hashed_password = hash_password(account.password.as_bytes());
22
23 let account = Account {
24 id: account.id,
25 email: account.email,
26 password: hashed_password,
27 };
28
29 match store.add_account(account).await {
30 Ok(_) => {
31 Ok(warp::reply::with_status("Account added", StatusCode::OK))
32 }
33 Err(e) => Err(warp::reject::custom(e)),
34 }
35}
36
37pub async fn login(
38 store: Store,

Callers

nothing calls this directly

Calls 2

hash_passwordFunction · 0.70
add_accountMethod · 0.45

Tested by

no test coverage detected