From 18a8c4a3d705535c0045d77db9b09cb1c7c3d72a Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Sun, 8 Sep 2024 22:09:16 -0400 Subject: [PATCH] Hack in registration prevention --- app/controllers/users_controller.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index e8058a3..614d8df 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -26,7 +26,10 @@ class UsersController < ApplicationController @user = User.new(user_params) respond_to do |format| - if @user.save + if ENV["REGISTRATION_ALLOWED"].blank? + format.html { redirect_to new_session_url, alert: "Registration disabled." } + format.json { render json: @user.errors, status: :unprocessable_entity } + elsif @user.save @session = Session.new(session_params).save session[:current_user_id] = @session.user_id