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 +4 -4
- data/lib/calib/devise/friendly_forwardable.rb +10 -5
- data/lib/calib/rails/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96047a475a532a0f692f9ee1fbbde4989e6d563ae91706c054defd7cfdd21a32
|
4
|
+
data.tar.gz: fc81798aa5b2a5b8ff45f2b187ae5f3e63e41e79917260fbb28c993095b65b08
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 :
|
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
|
-
|
13
|
-
|
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 !=
|
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
|
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
|
data/lib/calib/rails/version.rb
CHANGED