rodauth-omniauth 0.3.4 → 0.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 +11 -1
- data/lib/rodauth/features/omniauth.rb +23 -4
- data/lib/rodauth/features/omniauth_base.rb +3 -7
- data/rodauth-omniauth.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21b889e9c675d3fd02f65444f581e44965cb84982dd136fb912a5c9e6fb67c8c
|
4
|
+
data.tar.gz: 12a5f50598b671065998b012b9c54997dffa225d5d208d0a25ea90a48bfe3e8b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f54a94233c789532139f2e07173e5162209674cf8f90c441df0e603b49b5840b4edad89a0b2e7f9a48c25856ba2d64c9dfed31ff6e61ad219d1ee2725a0d8c03
|
7
|
+
data.tar.gz: c7d3c6db0088e544890cf7be482038d6c9f52c42a95082a5cc5d5bc1ba2dcf92ec7614d6c23b793f1814ac4ffb1272d280d67c527d023d1d437705a5383b608d
|
data/README.md
CHANGED
@@ -107,7 +107,17 @@ end
|
|
107
107
|
account_from_omniauth {} # disable finding existing accounts for new identities
|
108
108
|
```
|
109
109
|
|
110
|
-
|
110
|
+
#### Account verification
|
111
|
+
|
112
|
+
If the account associated to the external identity exists and is unverified (e.g. it was created through normal registration), the callback phase will automatically verify the account and login, assuming the `verify_account` feature is enabled and external email is the same.
|
113
|
+
|
114
|
+
If you wish to disallow OmniAuth login into unverified accounts, set the following:
|
115
|
+
|
116
|
+
```rb
|
117
|
+
omniauth_verify_account? false
|
118
|
+
```
|
119
|
+
|
120
|
+
You can change the default error flash and redirect location in this case:
|
111
121
|
|
112
122
|
```rb
|
113
123
|
omniauth_login_unverified_account_error_flash "The account matching the external identity is currently awaiting verification"
|
@@ -20,6 +20,10 @@ module Rodauth
|
|
20
20
|
auth_value_method :omniauth_identities_provider_column, :provider
|
21
21
|
auth_value_method :omniauth_identities_uid_column, :uid
|
22
22
|
|
23
|
+
auth_value_methods(
|
24
|
+
:omniauth_verify_account?,
|
25
|
+
)
|
26
|
+
|
23
27
|
auth_methods(
|
24
28
|
:create_omniauth_identity,
|
25
29
|
:omniauth_identity_insert_hash,
|
@@ -38,7 +42,7 @@ module Rodauth
|
|
38
42
|
|
39
43
|
def route_omniauth!
|
40
44
|
result = super
|
41
|
-
handle_omniauth_callback if
|
45
|
+
handle_omniauth_callback if omniauth_strategy&.on_callback_path?
|
42
46
|
result
|
43
47
|
end
|
44
48
|
|
@@ -62,9 +66,13 @@ module Rodauth
|
|
62
66
|
end
|
63
67
|
|
64
68
|
if account && !open_account?
|
65
|
-
|
66
|
-
|
67
|
-
|
69
|
+
if omniauth_verify_account?
|
70
|
+
omniauth_verify_account
|
71
|
+
else
|
72
|
+
set_response_error_reason_status(:unverified_account, unopen_account_error_status)
|
73
|
+
set_redirect_error_flash omniauth_login_unverified_account_error_flash
|
74
|
+
redirect omniauth_login_failure_redirect
|
75
|
+
end
|
68
76
|
end
|
69
77
|
|
70
78
|
transaction do
|
@@ -133,6 +141,17 @@ module Rodauth
|
|
133
141
|
|
134
142
|
attr_reader :omniauth_identity
|
135
143
|
|
144
|
+
def omniauth_verify_account?
|
145
|
+
features.include?(:verify_account) && account[login_column] == omniauth_email
|
146
|
+
end
|
147
|
+
|
148
|
+
def omniauth_verify_account
|
149
|
+
transaction do
|
150
|
+
verify_account
|
151
|
+
remove_verify_account_key
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
136
155
|
def _omniauth_new_account(login)
|
137
156
|
acc = { login_column => login }
|
138
157
|
unless skip_status_checks?
|
@@ -66,19 +66,19 @@ module Rodauth
|
|
66
66
|
|
67
67
|
%w[email name].each do |info_key|
|
68
68
|
define_method(:"omniauth_#{info_key}") do
|
69
|
-
omniauth_info[info_key]
|
69
|
+
omniauth_info[info_key] if omniauth_info
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
73
73
|
%w[provider uid info credentials extra].each do |auth_key|
|
74
74
|
define_method(:"omniauth_#{auth_key}") do
|
75
|
-
omniauth_auth
|
75
|
+
omniauth_auth[auth_key] if omniauth_auth
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
79
79
|
%w[auth params strategy origin error error_type error_strategy].each do |data|
|
80
80
|
define_method(:"omniauth_#{data}") do
|
81
|
-
request.env
|
81
|
+
request.env["omniauth.#{data.tr("_", ".")}"]
|
82
82
|
end
|
83
83
|
end
|
84
84
|
|
@@ -194,10 +194,6 @@ module Rodauth
|
|
194
194
|
end
|
195
195
|
end
|
196
196
|
|
197
|
-
def omniauth_request?
|
198
|
-
request.env.key?("omniauth.strategy")
|
199
|
-
end
|
200
|
-
|
201
197
|
def self.included(auth)
|
202
198
|
auth.extend ClassMethods
|
203
199
|
auth.instance_variable_set(:@omniauth_providers, [])
|
data/rodauth-omniauth.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rodauth-omniauth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Janko Marohnić
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-09-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rodauth
|
@@ -212,7 +212,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
212
212
|
- !ruby/object:Gem::Version
|
213
213
|
version: '0'
|
214
214
|
requirements: []
|
215
|
-
rubygems_version: 3.5.
|
215
|
+
rubygems_version: 3.5.11
|
216
216
|
signing_key:
|
217
217
|
specification_version: 4
|
218
218
|
summary: Rodauth extension for logging in and creating account via OmniAuth authentication.
|