From 10cd0527b16aa3d01cb4af708917ad95db142a1b Mon Sep 17 00:00:00 2001 From: gennyble Date: Sat, 26 Sep 2026 02:19:13 -0500 Subject: allow turning off registration --- splorm/src/handler/api/auth.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'splorm/src/handler/api') diff --git a/splorm/src/handler/api/auth.rs b/splorm/src/handler/api/auth.rs index e90eafe..a256ffd 100644 --- a/splorm/src/handler/api/auth.rs +++ b/splorm/src/handler/api/auth.rs @@ -5,21 +5,26 @@ use std::time::Duration; -use axum::{body::Body, extract::State, http::StatusCode, response::Response}; +use axum::{Extension, body::Body, extract::State, http::StatusCode, response::Response}; use gny::web::cookie::{self, SetCookie}; use sessionhash::RequestContext; use somethings::auth::Session; -use crate::{Query, RuntimeError, extractor::Wrap, state::SplormState}; +use crate::{Query, RuntimeError, config::Settings, extractor::Wrap, state::SplormState}; /// POST /auth/register pub async fn register( State(state): State, + Extension(settings): Extension, ctx: RequestContext, body: String, ) -> Result { tracing::trace!("{ctx} GET /api/register"); + if !settings.registration_enabled() { + return Err(RuntimeError::Generic403); + } + macro_rules! get { ($query:ident $field:literal) => { $query -- cgit 1.4.1-3-g733a5