Switch from respond_with_navigational to redirect_to

This replaces respond_with_navigational with redirect_to when
redirecting to the sign-in form after a failed sign-in attempts.

There seems to be an issue with respond_with_navigational that prevents
feature flags from being pushed to the frontend. This issue does not
seem to happen when using redirect_to.

Changelog: fixed
parent 27ccdd95
......@@ -126,7 +126,7 @@ class SessionsController < Devise::SessionsController
flash[:alert] = _('There was an error with the reCAPTCHA. Please solve the reCAPTCHA again.')
flash.delete :recaptcha_error
respond_with_navigational(resource) { render :new }
redirect_to new_user_session_path
end
end
......
......@@ -123,7 +123,7 @@ module EE
flash[:alert] = 'Login failed. Please retry from your primary device and network.'
flash.delete :recaptcha_error
respond_with_navigational(resource) { render :new }
redirect_to new_user_session_path
end
end
end
......@@ -169,7 +169,7 @@ RSpec.describe SessionsController, :geo do
end
post(:create, params: params, session: {})
expect(response).to render_template(:new)
expect(response).to redirect_to new_user_session_path
expect(flash[:alert]).to include 'Login failed. Please retry from your primary device and network'
expect(subject.current_user).to be_nil
end
......@@ -179,7 +179,7 @@ RSpec.describe SessionsController, :geo do
it 'prevents the user from logging in' do
post(:create, params: params.except!(:arkose_labs_token), session: {})
expect(response).to render_template(:new)
expect(response).to redirect_to new_user_session_path
expect(flash[:alert]).to include 'Login failed. Please retry from your primary device and network'
expect(subject.current_user).to be_nil
end
......
......@@ -238,7 +238,7 @@ RSpec.describe SessionsController do
unsuccesful_login(user_params)
expect(response).to render_template(:new)
expect(response).to redirect_to new_user_session_path
expect(flash[:alert]).to include _('There was an error with the reCAPTCHA. Please solve the reCAPTCHA again.')
expect(subject.current_user).to be_nil
end
......@@ -262,7 +262,7 @@ RSpec.describe SessionsController do
it 'displays an error when the reCAPTCHA is not solved' do
unsuccesful_login(user_params, sesion_params: { failed_login_attempts: 6 })
expect(response).to render_template(:new)
expect(response).to redirect_to new_user_session_path
expect(flash[:alert]).to include _('There was an error with the reCAPTCHA. Please solve the reCAPTCHA again.')
expect(subject.current_user).to be_nil
end
......@@ -282,7 +282,7 @@ RSpec.describe SessionsController do
it 'displays an error when the reCAPTCHA is not solved' do
unsuccesful_login(user_params)
expect(response).to render_template(:new)
expect(response).to redirect_to new_user_session_path
expect(flash[:alert]).to include _('There was an error with the reCAPTCHA. Please solve the reCAPTCHA again.')
expect(subject.current_user).to be_nil
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment