diff --git a/app/controllers/registrar/sessions_controller.rb b/app/controllers/registrar/sessions_controller.rb index 5a7bce72f..c45c930e1 100644 --- a/app/controllers/registrar/sessions_controller.rb +++ b/app/controllers/registrar/sessions_controller.rb @@ -171,8 +171,16 @@ class Registrar render text: t('registrar.authorization.ip_not_allowed', ip: request.ip) end + def current_ability + @current_ability ||= Ability.new(current_registrar_user, request.remote_ip) + end + def after_sign_in_path_for(_resource_or_scope) - registrar_root_path + if can?(:show, :poll) + registrar_poll_path + else + registrar_root_path + end end def after_sign_out_path_for(_resource_or_scope) diff --git a/test/integration/registrar/login_test.rb b/test/integration/registrar/login_test.rb index bfacd3c16..a70a9cf25 100644 --- a/test/integration/registrar/login_test.rb +++ b/test/integration/registrar/login_test.rb @@ -12,7 +12,7 @@ class RegistrarAreaLoginTest < ActionDispatch::IntegrationTest click_button 'Login' assert_text 'Log out' - assert_current_path registrar_root_path + assert_current_path registrar_poll_path end def test_wrong_password diff --git a/test/integration/registrar/protected_area_test.rb b/test/integration/registrar/protected_area_test.rb index 48de0bbb8..dd7f46980 100644 --- a/test/integration/registrar/protected_area_test.rb +++ b/test/integration/registrar/protected_area_test.rb @@ -17,6 +17,6 @@ class RegistrarAreaProtectedAreaTest < ActionDispatch::IntegrationTest sign_in users(:api_bestnames) visit new_registrar_user_session_url assert_text 'You are already signed in' - assert_current_path registrar_root_path + assert_current_path registrar_poll_path end end \ No newline at end of file