sync_attr_with_auth0 0.0.21 → 0.0.22
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/sync_attr_with_auth0/model.rb +21 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7788c4f5abc0773865898d924dc408dcec79679
|
4
|
+
data.tar.gz: f72a93fd6f27bc23a93cf35ceacbf454ed1a3948
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6bfad2038da2670a9d7f1f20868d397198bd1291f3413bc889adb2b082c661a8d2fffbb647c4ab8a7cc6db322e24b6673576b04896afb647cdd6642beaa4286f
|
7
|
+
data.tar.gz: 6a139dfb402e6e7227b19d8afb2aad3098100ebc7a1193ea01df6e52fa44fb48a161a2e5acbc25e831a55cedf6e54b596bf2476c750f537cf9893cc385af43c8
|
@@ -149,12 +149,7 @@ module SyncAttrWithAuth0
|
|
149
149
|
|
150
150
|
if (
|
151
151
|
auth0_sync_options[:sync_atts].index(auth0_sync_options[:password_att]) and
|
152
|
-
|
153
|
-
# field (and if it is it needs to be the unencrypted value), we
|
154
|
-
# can't rely on checking if the password attribute changed (chances
|
155
|
-
# are, that method does not exist). So assume the password attribute
|
156
|
-
# is only set if it's being changed.
|
157
|
-
!self.send(auth0_sync_options[:password_att]).nil?
|
152
|
+
auth0_user_password_changed?
|
158
153
|
)
|
159
154
|
# The password should be sync'd and was changed
|
160
155
|
args['password'] = self.send(auth0_sync_options[:password_att])
|
@@ -202,6 +197,20 @@ module SyncAttrWithAuth0
|
|
202
197
|
self.respond_to?(auth0_sync_options[:password_att]) ? self.send(auth0_sync_options[:password_att]) : auth0_default_password
|
203
198
|
end
|
204
199
|
|
200
|
+
def auth0_user_password_changed?
|
201
|
+
if self.respond_to?(auth0_sync_options[:password_att])
|
202
|
+
if self.respond_to?(:"#{auth0_sync_options[:password_att].to_s}_changed?")
|
203
|
+
# We have a changed method, use it
|
204
|
+
return self.send(:"#{auth0_sync_options[:password_att].to_s}_changed?")
|
205
|
+
else
|
206
|
+
# We don't have a changed method, check if the attribute was set.
|
207
|
+
return !self.send(auth0_sync_options[:password_att]).nil?
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
return false
|
212
|
+
end
|
213
|
+
|
205
214
|
def auth0_email_verified?
|
206
215
|
!!(self.respond_to?(auth0_sync_options[:email_verified_att]) ? self.send(auth0_sync_options[:email_verified_att]) : false)
|
207
216
|
end
|
@@ -234,9 +243,14 @@ module SyncAttrWithAuth0
|
|
234
243
|
end
|
235
244
|
|
236
245
|
def auth0_dirty?
|
237
|
-
!!(auth0_sync_options[:sync_atts].inject(false) do |memo, attrib|
|
246
|
+
is_dirty = !!(auth0_sync_options[:sync_atts].inject(false) do |memo, attrib|
|
238
247
|
memo || try("#{attrib}_changed?")
|
239
248
|
end)
|
249
|
+
|
250
|
+
# If the password was changed, force is_dirty to be true
|
251
|
+
is_dirty = true if auth0_user_password_changed?
|
252
|
+
|
253
|
+
return is_dirty
|
240
254
|
end
|
241
255
|
|
242
256
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sync_attr_with_auth0
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.22
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patrick McGraw
|
@@ -167,7 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
167
167
|
version: '0'
|
168
168
|
requirements: []
|
169
169
|
rubyforge_project:
|
170
|
-
rubygems_version: 2.4.
|
170
|
+
rubygems_version: 2.4.6
|
171
171
|
signing_key:
|
172
172
|
specification_version: 4
|
173
173
|
summary: Synchronize attributes on a local ActiveRecord user model with the user metadata
|