passwordless 1.3.0 → 1.4.0
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/README.md +2 -2
- data/app/controllers/passwordless/sessions_controller.rb +13 -5
- data/lib/passwordless/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6dc17e0a0f2696a647ba5f5dffaededf6494a48f4cd3393135e041c91b3955f0
|
4
|
+
data.tar.gz: b27244139169a60b25c1251321aa6576d7fbbe7e9e122cb5886041f7a60a4886
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66be83e8a5b1f8cd06d83196d94ce42e9fe25dbbd49a650ca553c8874ac47503758c782b10831187d7005666fbe73e1468fea82a9c6cdad21dae8abe85cfca22
|
7
|
+
data.tar.gz: 266ec15bbc186604c4ab0eda90171499052fa22e11d8eeb0c8f96196fe3363ee45c42d183d76a16dc90670308a1ae9a7bc84bfbb321a8c01fca815ae7e24b6cf
|
data/README.md
CHANGED
@@ -70,7 +70,7 @@ class ApplicationController < ActionController::Base
|
|
70
70
|
def require_user!
|
71
71
|
return if current_user
|
72
72
|
save_passwordless_redirect_location!(User) # <-- optional, see below
|
73
|
-
redirect_to root_path,
|
73
|
+
redirect_to root_path, alert: "You are not worthy!"
|
74
74
|
end
|
75
75
|
end
|
76
76
|
```
|
@@ -237,7 +237,7 @@ class ApplicationController < ActionController::Base
|
|
237
237
|
def require_user!
|
238
238
|
return if current_user
|
239
239
|
save_passwordless_redirect_location!(User) # <-- this one!
|
240
|
-
redirect_to root_path,
|
240
|
+
redirect_to root_path, alert: "You are not worthy!"
|
241
241
|
end
|
242
242
|
end
|
243
243
|
```
|
@@ -105,11 +105,11 @@ module Passwordless
|
|
105
105
|
protected
|
106
106
|
|
107
107
|
def passwordless_sign_out_redirect_path
|
108
|
-
Passwordless.config.sign_out_redirect_path
|
108
|
+
call_or_return(Passwordless.config.sign_out_redirect_path)
|
109
109
|
end
|
110
110
|
|
111
111
|
def passwordless_failure_redirect_path
|
112
|
-
Passwordless.config.failure_redirect_path
|
112
|
+
call_or_return(Passwordless.config.failure_redirect_path)
|
113
113
|
end
|
114
114
|
|
115
115
|
def passwordless_query_redirect_path
|
@@ -120,10 +120,14 @@ module Passwordless
|
|
120
120
|
end
|
121
121
|
|
122
122
|
def passwordless_success_redirect_path
|
123
|
-
|
123
|
+
success_redirect_path = call_or_return(Passwordless.config.success_redirect_path)
|
124
124
|
|
125
|
-
|
126
|
-
|
125
|
+
if Passwordless.config.redirect_back_after_sign_in
|
126
|
+
session_redirect_url = reset_passwordless_redirect_location!(authenticatable_class)
|
127
|
+
return passwordless_query_redirect_path || session_redirect_url || success_redirect_path
|
128
|
+
end
|
129
|
+
|
130
|
+
success_redirect_path
|
127
131
|
end
|
128
132
|
|
129
133
|
private
|
@@ -164,6 +168,10 @@ module Passwordless
|
|
164
168
|
authenticatable_type.constantize
|
165
169
|
end
|
166
170
|
|
171
|
+
def call_or_return(value)
|
172
|
+
value.respond_to?(:call) ? value.call : value
|
173
|
+
end
|
174
|
+
|
167
175
|
def find_authenticatable
|
168
176
|
if authenticatable_class.respond_to?(:fetch_resource_for_passwordless)
|
169
177
|
authenticatable_class.fetch_resource_for_passwordless(normalized_email_param)
|
data/lib/passwordless/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: passwordless
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mikkel Malmberg
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-01-
|
11
|
+
date: 2024-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|