Hack in registration prevention #37

Merged
atomaka merged 2 commits from prevent-registration into main 2024-09-08 22:18:56 -04:00
Showing only changes of commit 18a8c4a3d7 - Show all commits

View file

@ -26,7 +26,10 @@ class UsersController < ApplicationController
@user = User.new(user_params) @user = User.new(user_params)
respond_to do |format| 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 = Session.new(session_params).save
session[:current_user_id] = @session.user_id session[:current_user_id] = @session.user_id