2
0

Change redirection for denied registration from web app to sign-in page with error message (#36384)

This commit is contained in:
Claire
2025-10-15 13:37:22 +02:00
committed by GitHub
parent c6de46d12d
commit fab0dd0bcf
3 changed files with 6 additions and 5 deletions

View File

@@ -89,7 +89,7 @@ class Auth::RegistrationsController < Devise::RegistrationsController
end
def check_enabled_registrations
redirect_to root_path unless allowed_registration?(request.remote_ip, @invite)
redirect_to new_user_session_path, alert: I18n.t('devise.failure.closed_registrations', email: Setting.site_contact_email) unless allowed_registration?(request.remote_ip, @invite)
end
def invite_code

View File

@@ -7,6 +7,7 @@ en:
send_paranoid_instructions: If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes. Please check your spam folder if you didn't receive this email.
failure:
already_authenticated: You are already signed in.
closed_registrations: Your registration attempt has been blocked due to a network policy. If you believe this is an error, contact %{email}.
inactive: Your account is not activated yet.
invalid: Invalid %{authentication_keys} or password.
last_attempt: You have one more attempt before your account is locked.

View File

@@ -12,11 +12,11 @@ RSpec.describe Auth::RegistrationsController do
allow(Rails.configuration.x).to receive(:single_user_mode).and_return(true)
end
it 'redirects to root' do
it 'redirects to sign-in' do
Fabricate(:account)
get path
expect(response).to redirect_to '/'
expect(response).to redirect_to '/auth/sign_in'
expect(Rails.configuration.x).to have_received(:single_user_mode)
end
end
@@ -27,10 +27,10 @@ RSpec.describe Auth::RegistrationsController do
allow(Rails.configuration.x).to receive(:single_user_mode).and_return(false)
end
it 'redirects to root' do
it 'redirects to sign-in' do
get path
expect(response).to redirect_to '/'
expect(response).to redirect_to '/auth/sign_in'
expect(Rails.configuration.x).to have_received(:single_user_mode)
end
end