calib-rails 0.1.6 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a169448262ad90005944b50c2a715536f06f14ce4c3f7c9410b8c626cb06153d
4
- data.tar.gz: 0a8a6d38c66d06ba4aa7cad08688627e912ee52913cfc5fe1f4654013726583e
3
+ metadata.gz: 96047a475a532a0f692f9ee1fbbde4989e6d563ae91706c054defd7cfdd21a32
4
+ data.tar.gz: fc81798aa5b2a5b8ff45f2b187ae5f3e63e41e79917260fbb28c993095b65b08
5
5
  SHA512:
6
- metadata.gz: 9aedee16b3782063afeb706fea29e76be213b916997b2b0ad8867f185aac994f5fb08fc1594711a2d5510c4ff7876732e6fa0df5ce6a8706d4412a69612f1da0
7
- data.tar.gz: 681cf919772a6c90f154d6d539c8bb9dbebc1959d0e8a9c151e394b431fa0fcc34e9a5db07325be22f13aafdb98fd888f520feaeba2dcf0f3599044c4090e980
6
+ metadata.gz: 39ff9a79b7f682c4c7351016c490ed98b691f7b81f8a137baa84e9038e0d4b25f4b6be056896da1a126024edf3a0629c2138d8c63ee5bc622f7514759004f0b1
7
+ data.tar.gz: a88fa475189412f5d24ec13b6aa3a618d12340889cacbcb8406bc1399ea4e84bf7475c66bed59262b5e6799e09961c0e909a71a5aa7d8d02be919c49bdbb8912
@@ -3,25 +3,30 @@ module Calib::Devise::FriendlyForwardable
3
3
 
4
4
  included do
5
5
  # @see https://github.com/plataformatec/devise/wiki/How-To:-Redirect-back-to-current-page-after-sign-in,-sign-out,-sign-up,-update
6
- before_action :store_access_location!, if: :storable_location?
6
+ before_action :store_location!, if: :storable_location?
7
7
  end
8
8
 
9
9
  private
10
10
 
11
+ def after_sign_in_path_for(resource)
12
+ friendly_forwarding_path(resource)
13
+ end
14
+
11
15
  # path with stored_location or root
12
- def smart_path(r = devise_key_for_store_location)
13
- stored_location_for(r) || root_path
16
+ # @see https://github.com/plataformatec/devise/wiki/How-To:-redirect-to-a-specific-page-on-successful-sign-in
17
+ def friendly_forwarding_path(r = devise_key_for_store_location)
18
+ request.env['omniauth.origin'] || stored_location_for(r) || signed_in_root_path(r)
14
19
  end
15
20
 
16
21
  def storable_location?
17
22
  request.get? &&
18
23
  is_navigational_format? &&
19
24
  !devise_controller? &&
20
- request.fullpath != root_path && # for return on creating new account
25
+ request.fullpath != signed_in_root_path(devise_key_for_store_location) && # for return on creating new account
21
26
  !request.xhr?
22
27
  end
23
28
 
24
- def store_access_location!
29
+ def store_location!
25
30
  Rails.logger.debug("store_#{devise_key_for_store_location}_location!: #{request.fullpath}")
26
31
  store_location_for(devise_key_for_store_location, request.fullpath)
27
32
  end
@@ -1,5 +1,5 @@
1
1
  module Calib
2
2
  module Rails
3
- VERSION = '0.1.6'
3
+ VERSION = '0.1.7'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calib-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - ms2sato