Skip to content

Commit

Permalink
Redirect admin user to admin context (#530)
Browse files Browse the repository at this point in the history
#### 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
guimello authored Dec 16, 2022
1 parent 4c2dc6f commit 6db187d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## Next

# [1.35.1] - 08/12/2022

* [PR 530] Redirect admin user to admin context

# [1.35.0] - 14/12/2020

* [PR 513] Allow skipping the app landing page when the url contains a special key
Expand Down
6 changes: 4 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,9 @@ GEM
mime-types (3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521)
mimemagic (0.3.2)
mimemagic (0.3.10)
nokogiri (~> 1)
rake
mini_magick (4.8.0)
mini_mime (1.0.0)
mini_portile2 (2.3.0)
Expand Down Expand Up @@ -553,9 +555,9 @@ GEM
rspec-mocks (~> 3.7.0)
rspec-support (~> 3.7.0)
rspec-support (3.7.1)
ruby-rc4 (0.1.5)
ruby_parser (3.14.2)
sexp_processor (~> 4.9)
ruby-rc4 (0.1.5)
sass (3.5.5)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
Expand Down
10 changes: 10 additions & 0 deletions app/controllers/admin/admin_users/sessions_controller.rb
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
2 changes: 1 addition & 1 deletion docker/install-image-magick.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ IMAGE_MAGICK_DIR="ImageMagick-$IMAGE_MAGICK_VERSION"
IMAGE_MAGICK_URL="http://www.imagemagick.org/download/releases/$IMAGE_MAGICK_FILE"

echo "-----> Downloading ImageMagick from $IMAGE_MAGICK_URL"
wget $IMAGE_MAGICK_URL -P $BUILD_DIR | indent
wget --no-check-certificate $IMAGE_MAGICK_URL -P $BUILD_DIR | indent

echo "-----> Extracting ImageMagick from $BUILD_DIR/$IMAGE_MAGICK_FILE"
if [ ! -f $BUILD_DIR/$IMAGE_MAGICK_FILE ]; then
Expand Down

0 comments on commit 6db187d

Please sign in to comment.