Hack in registration prevention
Some checks failed
Ruby CI / test (pull_request) Failing after 17s

This commit is contained in:
Andrew Tomaka 2024-09-08 22:09:16 -04:00
parent 0a25c2ae9a
commit 18a8c4a3d7
Signed by: atomaka
GPG key ID: 61209BF70A5B18BE

View file

@ -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