Skip to content

Commit 0a791a5

Browse files
committed
fix(nbp): Add redirect to root when unauthorized on /users/nbp_wallet/*
Usually, when the current user is not logged in and unauthorized, a redirect to the registration page makes sense. But in case of the `NBPWalletController` actions, the SAML provider and uid are missing and the provided alert message is more meaningful. Part of XI-6523
1 parent 2da5947 commit 0a791a5

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

app/controllers/application_controller.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ def render_error(message, status) # rubocop:disable Metrics/AbcSize
8282
if request.url == request.referer || request.referer&.match?(new_user_session_path)
8383
redirect_to :root, alert: message
8484
elsif current_user.nil? && status == :unauthorized
85+
return redirect_to :root, alert: message if request.path.start_with?('/users/nbp_wallet')
86+
8587
store_location_for(:user, request.fullpath) if current_user.nil?
8688
redirect_to new_user_session_path, alert: t('common.errors.not_signed_in')
8789
else

0 commit comments

Comments
 (0)