diff options
| author | gennyble <gen@nyble.dev> | 2026-09-26 02:19:13 -0500 |
|---|---|---|
| committer | gennyble <gen@nyble.dev> | 2026-09-26 02:19:13 -0500 |
| commit | 10cd0527b16aa3d01cb4af708917ad95db142a1b (patch) | |
| tree | aef45da935eb79ce92a2ffe51433153322a2092c /splorm/src/handler | |
| parent | 90cb2ffd874a1aeecaf4ace90c0c1155f28287b5 (diff) | |
allow turning off registration
Diffstat (limited to 'splorm/src/handler')
| -rw-r--r-- | splorm/src/handler/api/auth.rs | 9 |
1 files changed, 7 insertions, 2 deletions
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<SplormState>, + Extension(settings): Extension<Settings>, ctx: RequestContext, body: String, ) -> Result<Response, RuntimeError> { tracing::trace!("{ctx} GET /api/register"); + if !settings.registration_enabled() { + return Err(RuntimeError::Generic403); + } + macro_rules! get { ($query:ident $field:literal) => { $query |
