about summary refs log tree commit diff
path: root/app/controllers/auth
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2022-08-25 06:15:55 +0200
committerGitHub <noreply@github.com>2022-08-25 06:15:55 +0200
commit4be626734dfe5d5bb550b117d966aa3f93d0ef38 (patch)
treeab558edfd645052e92881137fdd95a66c1e4eb03 /app/controllers/auth
parent5a3d09dc8e30198b4d8d921ef0b1ba0a35fe01d9 (diff)
parent448ed92f76981f40d6faf48ed9d798ee716a04b2 (diff)
Merge pull request #1827 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/controllers/auth')
-rw-r--r--app/controllers/auth/registrations_controller.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/controllers/auth/registrations_controller.rb b/app/controllers/auth/registrations_controller.rb
index 1c0f360a9..486edcdcb 100644
--- a/app/controllers/auth/registrations_controller.rb
+++ b/app/controllers/auth/registrations_controller.rb
@@ -83,7 +83,7 @@ class Auth::RegistrationsController < Devise::RegistrationsController
   end
 
   def check_enabled_registrations
-    redirect_to root_path if single_user_mode? || omniauth_only? || !allowed_registrations?
+    redirect_to root_path if single_user_mode? || omniauth_only? || !allowed_registrations? || ip_blocked?
   end
 
   def allowed_registrations?
@@ -94,6 +94,10 @@ class Auth::RegistrationsController < Devise::RegistrationsController
     ENV['OMNIAUTH_ONLY'] == 'true'
   end
 
+  def ip_blocked?
+    IpBlock.where(severity: :sign_up_block).where('ip >>= ?', request.remote_ip.to_s).exists?
+  end
+
   def invite_code
     if params[:user]
       params[:user][:invite_code]