summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGalen Guyer <galen@galenguyer.com>2022-06-02 22:31:46 -0400
committerGalen Guyer <galen@galenguyer.com>2022-06-02 22:31:46 -0400
commit4d6995322191cb7d20a6f09bbadf20691214e0d2 (patch)
treea96f55cac55cfa4a7f3431fa73eb8c3cf9ff64be
parent0a3b7624f310201e0aa5ac235150acc4933d75d0 (diff)
check signups_enabled feature in signup route
-rw-r--r--src/routes/v1/users.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/routes/v1/users.rs b/src/routes/v1/users.rs
index 10afc0c..a3f1810 100644
--- a/src/routes/v1/users.rs
+++ b/src/routes/v1/users.rs
@@ -24,6 +24,12 @@ pub async fn create_user(
Json(signup): Json<requests::Signup>,
Extension(pool): Extension<Arc<Pool<Postgres>>>,
) -> impl IntoResponse {
+ if !(*crate::features::SIGNUPS_ENABLED) {
+ return (
+ StatusCode::BAD_REQUEST,
+ Json(json!({ "error": "Signups are not enabled" })),
+ );
+ }
// TODO: Potentially more checks for password strength
if signup.password.len() < 12 {
return (