Skip to content

Commit 3ca429f

Browse files
committed
Fix sign on and sign off redirect paths
1 parent f2db055 commit 3ca429f

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

app/controllers/better_together/application_controller.rb

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,17 @@ def store_user_location!
161161
store_location_for(:user, request.fullpath)
162162
end
163163

164-
def after_sign_in_path_for(resource_or_scope)
165-
stored_location_for(resource_or_scope)
164+
def after_sign_in_path_for(resource)
165+
stored_location_for(resource) ||
166+
if resource.permitted_to?('manage_platform')
167+
host_dashboard_path
168+
else
169+
BetterTogether.base_path_with_locale
170+
end
171+
end
172+
173+
def after_sign_out_path_for(resource_or_scope)
174+
BetterTogether.base_path_with_locale
166175
end
167176
end
168177
end

app/controllers/better_together/users/sessions_controller.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ module Users
55
class SessionsController < ::Devise::SessionsController # rubocop:todo Style/Documentation
66
include DeviseLocales
77
skip_before_action :check_platform_privacy
8+
9+
def respond_to_on_destroy
10+
respond_to do |format|
11+
format.all { head :no_content }
12+
format.any(*navigational_formats) { redirect_to after_sign_out_path_for(resource_name), status: :see_other}
13+
end
14+
end
815
end
916
end
1017
end

0 commit comments

Comments
 (0)