Browse Source

make organisations list page default view for support user login (#605)

pull/619/head
Dushan 3 years ago committed by baarkerlounger
parent
commit
3678bf08c9
  1. 8
      app/controllers/auth/two_factor_authentication_controller.rb
  2. 10
      spec/features/user_spec.rb

8
app/controllers/auth/two_factor_authentication_controller.rb

@ -22,4 +22,12 @@ private
render :show, status: :unprocessable_entity render :show, status: :unprocessable_entity
end end
end end
def after_two_factor_success_path_for(resource)
if resource.is_a?(User) && resource.support?
"/organisations"
else
super
end
end
end end

10
spec/features/user_spec.rb

@ -399,6 +399,16 @@ RSpec.describe "User Features" do
) )
click_button("Sign in") click_button("Sign in")
end end
it "the admin user is redirected to the organisations list page on successful sign in" do
visit("/account/sign-in")
fill_in("user[email]", with: support_user.email)
fill_in("user[password]", with: support_user.password)
click_button("Sign in")
fill_in("code", with: otp)
click_button("Submit")
expect(page).to have_current_path("/organisations")
end
end end
context "with a valid 2FA code" do context "with a valid 2FA code" do

Loading…
Cancel
Save