fix registration (#740)
This commit is contained in:
parent
b80f91c6a2
commit
fe67dbb96c
1 changed files with 2 additions and 4 deletions
|
@ -2,7 +2,7 @@ use std::borrow::Borrow;
|
||||||
|
|
||||||
use axum::{
|
use axum::{
|
||||||
extract::{Path, State},
|
extract::{Path, State},
|
||||||
Extension, Json,
|
Json,
|
||||||
};
|
};
|
||||||
use http::StatusCode;
|
use http::StatusCode;
|
||||||
use sodiumoxide::crypto::pwhash::argon2id13;
|
use sodiumoxide::crypto::pwhash::argon2id13;
|
||||||
|
@ -14,7 +14,6 @@ use crate::{
|
||||||
database::Database,
|
database::Database,
|
||||||
models::{NewSession, NewUser},
|
models::{NewSession, NewUser},
|
||||||
router::AppState,
|
router::AppState,
|
||||||
settings::Settings,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use atuin_common::api::*;
|
use atuin_common::api::*;
|
||||||
|
@ -59,11 +58,10 @@ pub async fn get<DB: Database>(
|
||||||
|
|
||||||
#[instrument(skip_all)]
|
#[instrument(skip_all)]
|
||||||
pub async fn register<DB: Database>(
|
pub async fn register<DB: Database>(
|
||||||
settings: Extension<Settings>,
|
|
||||||
state: State<AppState<DB>>,
|
state: State<AppState<DB>>,
|
||||||
Json(register): Json<RegisterRequest>,
|
Json(register): Json<RegisterRequest>,
|
||||||
) -> Result<Json<RegisterResponse>, ErrorResponseStatus<'static>> {
|
) -> Result<Json<RegisterResponse>, ErrorResponseStatus<'static>> {
|
||||||
if !settings.open_registration {
|
if !state.settings.open_registration {
|
||||||
return Err(
|
return Err(
|
||||||
ErrorResponse::reply("this server is not open for registrations")
|
ErrorResponse::reply("this server is not open for registrations")
|
||||||
.with_status(StatusCode::BAD_REQUEST),
|
.with_status(StatusCode::BAD_REQUEST),
|
||||||
|
|
Loading…
Reference in a new issue