about summary refs log tree commit diff
path: root/splorm/src/handler/api
diff options
context:
space:
mode:
Diffstat (limited to 'splorm/src/handler/api')
-rw-r--r--splorm/src/handler/api/auth.rs9
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