omniauth-identity 3.0.7 → 3.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 89bd05bb3cf63c0a47e41c8f955f9b076d5c6b4ae0704eda10819f801eaa6059
4
- data.tar.gz: a272f35f9bcc0de8937279904e2bde912865b50ac3a7752dada19f0ec7d6868c
3
+ metadata.gz: 26637a55190cccdef70e9a1fc568005e23b7ebff9ba3ec6d2f5ea4398117f04d
4
+ data.tar.gz: d31d884aae50bd00c0d3820030c107def5bbcaf6507eb5628e068ac090ccc8c7
5
5
  SHA512:
6
- metadata.gz: 26286ae10ba06b45b815bd21892ac27378eb338e446f0dcbe96037a8aa51d4097b55243ae12f5feef133577b1d793ce4732f636f930a6773c6b7e154e6256b4c
7
- data.tar.gz: 11fc92beba0b8b849c1ce15784870bf4318aeaea14e5c7172f9c26b1891e357ba9603106765a5b2554c20d177a17c5e820bdb01733de169f3e67ec192f8d42e4
6
+ metadata.gz: 86f91851a1e9884d95e3b3d765176f8faed5c7acbf7d79e168d803a09275c228a5cfe1221ee5fedd69689fccbc2af04d4857342bf5ae273f7a4d873a5e7e36c7
7
+ data.tar.gz: 81462770cbbd476db63d133831a36710178fef1702f5277a8a13248c17bf3fd91bba74f81337239b43202b10c079a3196f2ce912452c803e387c13b0c7361214
data/CHANGELOG.md CHANGED
@@ -8,6 +8,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8
8
 
9
9
  ## [Unreleased]
10
10
 
11
+ ## [3.0.8] - 2021-03-24
12
+
13
+ ### Fixed
14
+
15
+ - \[Model\] Fixes 2 issues raised in a comment on PR [#108](https://github.com/omniauth/omniauth-identity/pull/108#issuecomment-804456604)
16
+ - When `options[:on_validation]` is set `new`/`save`/`persisted?` logic is used.
17
+ - When `options[:on_validation]` is not set `create`/`persisted?` logic is used.
18
+
11
19
  ## [3.0.7] - 2021-03-23
12
20
 
13
21
  ### Fixed
@@ -2,6 +2,6 @@
2
2
 
3
3
  module OmniAuth
4
4
  module Identity
5
- VERSION = '3.0.7'
5
+ VERSION = '3.0.8'
6
6
  end
7
7
  end
@@ -76,17 +76,19 @@ module OmniAuth
76
76
  if model.respond_to?(:column_names) && model.column_names.include?('provider')
77
77
  attributes.reverse_merge!(provider: 'identity')
78
78
  end
79
- @identity = model.new(attributes)
80
- if saving_instead_of_creating?
79
+ if validating?
80
+ @identity = model.new(attributes)
81
81
  env['omniauth.identity'] = @identity
82
- if !validating? || valid?
82
+ if valid?
83
83
  @identity.save
84
84
  registration_result
85
85
  else
86
86
  registration_failure(options[:validation_failure_message])
87
87
  end
88
88
  else
89
- deprecated_registration(attributes)
89
+ @identity = model.create(attributes)
90
+ env['omniauth.identity'] = @identity
91
+ registration_result
90
92
  end
91
93
  end
92
94
 
@@ -141,10 +143,6 @@ module OmniAuth
141
143
  end
142
144
  end
143
145
 
144
- def saving_instead_of_creating?
145
- @identity.respond_to?(:save) && @identity.respond_to?(:persisted?)
146
- end
147
-
148
146
  # Validates the model before it is persisted
149
147
  #
150
148
  # @return [truthy or falsey] :on_validation option is truthy or falsey
@@ -177,17 +175,6 @@ module OmniAuth
177
175
  registration_failure(options[:registration_failure_message])
178
176
  end
179
177
  end
180
-
181
- def deprecated_registration(attributes)
182
- warn <<~CREATEDEP
183
- [DEPRECATION] Please define '#{model.class}#save'.
184
- Behavior based on '#{model.class}.create' will be removed in omniauth-identity v4.0.
185
- See lib/omniauth/identity/model.rb
186
- CREATEDEP
187
- @identity = model.create(attributes)
188
- env['omniauth.identity'] = @identity
189
- registration_result
190
- end
191
178
  end
192
179
  end
193
180
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-identity
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.7
4
+ version: 3.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Boling