fix registration (#740)

This commit is contained in:
Conrad Ludgate 2023-02-28 15:46:24 +00:00 committed by GitHub
parent b80f91c6a2
commit fe67dbb96c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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),