passwordless 0.4.0 → 0.4.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f03719e6034346b778069e91f121cbbc2eac0622e31595ef07a056cb0ac3301
|
4
|
+
data.tar.gz: ea42e801a9a60d28f75a16ca17c9d42027c34d7f3d761514a4705d24950c02e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6a9779ad51b363c0f9341abb88045d337f6acaee8dc2dd32c565bd2ecdac5608d1686e5bbf1e498b5db15a3cd435147fb4353af60027e191f1b7ea4454975e3
|
7
|
+
data.tar.gz: 0ff640ef5688934b062cc1678df6ab858bc35bb02389f2e20f9e1fbccfbbb6aadcafea4ae0d05a64e5901876103df701d7db9519ec359bc9465588c61a16c4b3
|
data/README.md
CHANGED
@@ -162,7 +162,7 @@ class ApplicationController < ActionController::Base
|
|
162
162
|
|
163
163
|
def require_user!
|
164
164
|
return if current_user
|
165
|
-
save_passwordless_redirect_location! # <-- here we go!
|
165
|
+
save_passwordless_redirect_location!(User) # <-- here we go!
|
166
166
|
redirect_to root_path, flash: {error: 'You are not worthy!'}
|
167
167
|
end
|
168
168
|
end
|
@@ -43,7 +43,7 @@ module Passwordless
|
|
43
43
|
sign_in session.authenticatable
|
44
44
|
|
45
45
|
enabled = Passwordless.redirect_back_after_sign_in
|
46
|
-
destination = dest = reset_passwordless_redirect_location!
|
46
|
+
destination = dest = reset_passwordless_redirect_location!(User)
|
47
47
|
|
48
48
|
if enabled && destination
|
49
49
|
redirect_to dest
|
@@ -20,16 +20,20 @@ module Passwordless
|
|
20
20
|
cookies.delete(key)
|
21
21
|
end
|
22
22
|
|
23
|
-
def save_passwordless_redirect_location!
|
24
|
-
session[
|
23
|
+
def save_passwordless_redirect_location!(authenticatable_class)
|
24
|
+
session[session_key(authenticatable_class)] = request.original_url
|
25
25
|
end
|
26
26
|
|
27
|
-
def reset_passwordless_redirect_location!
|
28
|
-
session.delete
|
27
|
+
def reset_passwordless_redirect_location!(authenticatable_class)
|
28
|
+
session.delete session_key(authenticatable_class)
|
29
29
|
end
|
30
30
|
|
31
31
|
private
|
32
32
|
|
33
|
+
def session_key(authenticatable_class)
|
34
|
+
:"passwordless_prev_location--#{authenticatable_class}"
|
35
|
+
end
|
36
|
+
|
33
37
|
def cookie_name(authenticatable_class)
|
34
38
|
:"#{authenticatable_class.to_s.underscore}_id"
|
35
39
|
end
|
data/lib/passwordless/version.rb
CHANGED