enabled registration

This commit is contained in:
2025-12-31 16:23:08 +01:00
parent fb4e827b12
commit 41ec77c862
2 changed files with 2 additions and 2 deletions

View File

@@ -4,4 +4,4 @@
- Specify the JWT secret with the `CHATAPP_JWT_SECRET` environment variable.
- Specify the server's port with the `CHATAPP_PORT` environment variable. Defaults to `8080`.
- To enable user registration, pass in `CHATAPP_ALLOW_REGISTRATION=true`.
- To disable user registration, pass in `CHATAPP_PROHIBIT_REGISTRATION=true`.

View File

@@ -52,7 +52,7 @@ pub fn routes() -> Router {
async fn registration_guard(req: Request, next: Next) -> Result<Response, StatusCode> {
if req.uri().path() == "/register"
&& env::var("CHATAPP_ALLOW_REGISTRATION").map_or(true, |v| v.to_lowercase() == "false")
&& env::var("CHATAPP_PROHIBIT_REGISTRATION").map_or(false, |v| v.to_lowercase() == "true")
{
return Err(StatusCode::FORBIDDEN);
}