-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Redirect admin user to admin context (#530)
#### Current state When accessing the `admin_users/sign_in` page, the user will be redirected to the root page "/", instead of the "admin" context. #### What has changed? Now the user will be redirected to the admin context, but old behavior sill works. If another admin page has been accessed, the user will be redirected to that instead.
- Loading branch information
Showing
4 changed files
with
19 additions
and
3 deletions.
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
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 |
---|---|---|
@@ -1,3 +1,13 @@ | ||
class Admin::AdminUsers::SessionsController < Devise::SessionsController | ||
layout 'admin/application' | ||
|
||
def after_sign_in_path_for(resource_or_scope) | ||
previous_path = super(resource_or_scope) | ||
|
||
unless previous_path.to_s.start_with? admin_path | ||
return admin_path | ||
end | ||
|
||
previous_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