forked from AlchemyCMS/alchemy-solidus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Solidus admin unauthorized redirect handler
If someone just requests '/admin' without being logged in Solidus renders '/unauthorized'. In solidus_auth_devise there is a redirect handler for this case that redirects to '/login'. In case we do not have solidus_auth_devise we need to provide a handler that redirects to Alchemy.login_path. Refs AlchemyCMS#32
- Loading branch information
Showing
4 changed files
with
17 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Spree::Admin::BaseController.unauthorized_redirect = -> do | ||
if try_spree_current_user | ||
flash[:error] = I18n.t('spree.authorization_failure') | ||
redirect_to spree.root_path | ||
else | ||
store_location | ||
redirect_to alchemy.login_path | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters