diff options
author | Galen Guyer <galen@galenguyer.com> | 2022-06-02 22:33:09 -0400 |
---|---|---|
committer | Galen Guyer <galen@galenguyer.com> | 2022-06-02 22:33:09 -0400 |
commit | 488a023a113dd6b4f7bc6cdedd0c7de290b194ba (patch) | |
tree | d92743688f4009854f091e7bcf7de396a3a5962f | |
parent | 4d6995322191cb7d20a6f09bbadf20691214e0d2 (diff) |
check totp_enabled feature when checking if a totp is required
-rw-r--r-- | src/routes/v1/users.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/routes/v1/users.rs b/src/routes/v1/users.rs index a3f1810..36206c7 100644 --- a/src/routes/v1/users.rs +++ b/src/routes/v1/users.rs @@ -85,6 +85,12 @@ pub async fn needs_totp( Query(params): Query<HashMap<String, String>>, Extension(pool): Extension<Arc<Pool<Postgres>>>, ) -> impl IntoResponse { + if !(*crate::features::TOTP_ENABLED) { + return ( + StatusCode::BAD_REQUEST, + Json(json!({ "error": "TOTP is not enabled" })), + ); + } match params.get("email") { Some(email) => match db::users::get_user(&pool, email).await { Ok(user) => ( |