From d9a8c50f9279a40c42ed9a8d3f4c8f11313046e2 Mon Sep 17 00:00:00 2001 From: multiple creatures Date: Tue, 6 Aug 2019 23:07:08 -0500 Subject: remember login & clear signed-in notice when switching accounts --- app/controllers/auth/sessions_controller.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'app/controllers') diff --git a/app/controllers/auth/sessions_controller.rb b/app/controllers/auth/sessions_controller.rb index 413962607..0b291e231 100644 --- a/app/controllers/auth/sessions_controller.rb +++ b/app/controllers/auth/sessions_controller.rb @@ -117,7 +117,11 @@ class Auth::SessionsController < Devise::SessionsController target_user = User.find_by(id: switch_params[:switch_to]) return unless target_user.present? && current_user.in?(target_user.linked_users) self.resource = target_user + remember_me(target_user) sign_in(target_user) + flash.delete(:error) + flash.delete(:alert) + flash.delete(:notice) return root_path end -- cgit