diff options
| author | Ellie Huxtable <e@elm.sh> | 2021-04-20 21:53:07 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-20 20:53:07 +0000 |
| commit | a21737e2b7f8d1e426726bdd7536033f299d476a (patch) | |
| tree | e940afdff9c145d25d9a2895fd44a77d70719a2e /src/server/handlers/user.rs | |
| parent | Switch to Warp + SQLx, use async, switch to Rust stable (#36) (diff) | |
| download | atuin-a21737e2b7f8d1e426726bdd7536033f299d476a.zip | |
Use cargo workspaces (#37)
* Switch to Cargo workspaces
Breaking things into "client", "server" and "common" makes managing the
codebase much easier!
client - anything running on a user's machine for adding history
server - handles storing/syncing history and running a HTTP server
common - request/response API definitions, common utils, etc
* Update dockerfile
Diffstat (limited to '')
| -rw-r--r-- | atuin-server/src/handlers/user.rs (renamed from src/server/handlers/user.rs) | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/server/handlers/user.rs b/atuin-server/src/handlers/user.rs index 782d7dbd..6b142cdc 100644 --- a/src/server/handlers/user.rs +++ b/atuin-server/src/handlers/user.rs @@ -5,13 +5,14 @@ use uuid::Uuid; use warp::http::StatusCode; use warp::reply::json; -use crate::api::{ +use atuin_common::api::{ ErrorResponse, LoginRequest, LoginResponse, RegisterRequest, RegisterResponse, UserResponse, }; -use crate::server::database::Database; -use crate::server::models::{NewSession, NewUser}; +use atuin_common::utils::hash_secret; + +use crate::database::Database; +use crate::models::{NewSession, NewUser}; use crate::settings::Settings; -use crate::utils::hash_secret; pub fn verify_str(secret: &str, verify: &str) -> bool { sodiumoxide::init().unwrap(); @@ -52,7 +53,7 @@ pub async fn register( settings: Settings, db: impl Database + Clone + Send + Sync, ) -> Result<Box<dyn warp::Reply>, Infallible> { - if !settings.server.open_registration { + if !settings.open_registration { return Ok(Box::new(ErrorResponse::reply( "this server is not open for registrations", StatusCode::BAD_REQUEST, |
