(
store: Store,
account: Account,
)
| 15 | use crate::types::account::{Account, AccountId, Session}; |
| 16 | |
| 17 | pub 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 | |
| 37 | pub async fn login( |
| 38 | store: Store, |
nothing calls this directly
no test coverage detected