mirror of
https://github.com/atuinsh/atuin.git
synced 2024-12-27 01:19:45 +01:00
fix registration (#740)
This commit is contained in:
parent
b80f91c6a2
commit
fe67dbb96c
@ -2,7 +2,7 @@ use std::borrow::Borrow;
|
||||
|
||||
use axum::{
|
||||
extract::{Path, State},
|
||||
Extension, Json,
|
||||
Json,
|
||||
};
|
||||
use http::StatusCode;
|
||||
use sodiumoxide::crypto::pwhash::argon2id13;
|
||||
@ -14,7 +14,6 @@ use crate::{
|
||||
database::Database,
|
||||
models::{NewSession, NewUser},
|
||||
router::AppState,
|
||||
settings::Settings,
|
||||
};
|
||||
|
||||
use atuin_common::api::*;
|
||||
@ -59,11 +58,10 @@ pub async fn get<DB: Database>(
|
||||
|
||||
#[instrument(skip_all)]
|
||||
pub async fn register<DB: Database>(
|
||||
settings: Extension<Settings>,
|
||||
state: State<AppState<DB>>,
|
||||
Json(register): Json<RegisterRequest>,
|
||||
) -> Result<Json<RegisterResponse>, ErrorResponseStatus<'static>> {
|
||||
if !settings.open_registration {
|
||||
if !state.settings.open_registration {
|
||||
return Err(
|
||||
ErrorResponse::reply("this server is not open for registrations")
|
||||
.with_status(StatusCode::BAD_REQUEST),
|
||||
|
Loading…
Reference in New Issue
Block a user