(
store: Store,
account: Account,
)
| 17 | const PASETO_KEY: &[u8; 32] = b"RANDOM WORDS WINTER MACINTOSH PC"; |
| 18 | |
| 19 | pub async fn register( |
| 20 | store: Store, |
| 21 | account: Account, |
| 22 | ) -> Result<impl warp::Reply, warp::Rejection> { |
| 23 | let hashed_password = hash_password(account.password.as_bytes()); |
| 24 | |
| 25 | let account = Account { |
| 26 | id: account.id, |
| 27 | email: account.email, |
| 28 | password: hashed_password, |
| 29 | }; |
| 30 | |
| 31 | match store.add_account(account).await { |
| 32 | Ok(_) => { |
| 33 | Ok(warp::reply::with_status("Account added", StatusCode::OK)) |
| 34 | } |
| 35 | Err(e) => Err(warp::reject::custom(e)), |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | pub async fn login( |
| 40 | store: Store, |
nothing calls this directly
no test coverage detected