bpluser 0.0.17 → 0.0.18
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/app/models/bpluser/user.rb +12 -8
- data/app/models/bpluser/validatable.rb +2 -2
- data/lib/bpluser/version.rb +1 -1
- 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: a184b0220732712ea2ca33ba036030b536d974e4
|
4
|
+
data.tar.gz: d85e0ab34d54d4886dd00837728f6abdb6ab5fa8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a72efada4fce7d24dcd7481e523f606c0f4147c841a3c0bf818d1bfcc85d1002213f6bb069a79b871ba690089ac618fe9d1981bbea16b4aa14bbcdb2250a32c
|
7
|
+
data.tar.gz: 5d887691378eeac07aae08741e9e26d163ec0ba7fbeb8c0deefd9bf4475dcf95aa685462e3cf15a2eaea44af3f831b32df94725d4dbfd4f635e6dea88e999d58
|
data/app/models/bpluser/user.rb
CHANGED
@@ -23,8 +23,6 @@ module Bpluser::User
|
|
23
23
|
ldap_raw_details = auth_response[:extra][:raw_info]
|
24
24
|
ldap_info_details = auth_response[:info]
|
25
25
|
|
26
|
-
puts ldap_raw_details.samaccountname[0].downcase
|
27
|
-
|
28
26
|
user = User.where(:provider => auth_response.provider, :uid => ldap_raw_details.samaccountname[0].downcase).first
|
29
27
|
|
30
28
|
#first_name:ldap_info_details.first_name,
|
@@ -108,20 +106,22 @@ module Bpluser::User
|
|
108
106
|
def find_for_local_auth(auth, signed_in_resource=nil)
|
109
107
|
user = User.where(:provider => auth.provider, :uid => auth.uid).first
|
110
108
|
unless user
|
111
|
-
user = User.create(display_name:auth.
|
109
|
+
user = User.create(display_name:auth.full_name,
|
112
110
|
uid:auth.uid,
|
113
111
|
provider:auth.provider,
|
114
|
-
username:auth.
|
115
|
-
email:auth.
|
116
|
-
password:
|
117
|
-
first_name:auth.
|
118
|
-
last_name:auth.
|
112
|
+
username:auth.uid,
|
113
|
+
email:auth.email,
|
114
|
+
password:auth.password,
|
115
|
+
first_name:auth.first_name,
|
116
|
+
last_name:auth.last_name
|
119
117
|
)
|
120
118
|
end
|
121
119
|
user
|
122
120
|
end
|
123
121
|
|
124
122
|
|
123
|
+
|
124
|
+
|
125
125
|
# This method should find User objects using the user_key you've chosen.
|
126
126
|
# By default, uses the unique identifier specified in by devise authentication_keys (ie. find_by_id, or find_by_email).
|
127
127
|
# You must have that find method implemented on your user class, or must override find_by_user_key
|
@@ -197,5 +197,9 @@ module Bpluser::User
|
|
197
197
|
roles.where(name: 'superuser').exists?
|
198
198
|
end
|
199
199
|
|
200
|
+
def permanent_account?
|
201
|
+
return self.provider != 'digital_stacks_temporary'
|
202
|
+
end
|
203
|
+
|
200
204
|
end
|
201
205
|
end
|
@@ -25,9 +25,9 @@ module Bpluser::Validatable
|
|
25
25
|
assert_validations_api!(base)
|
26
26
|
|
27
27
|
base.class_eval do
|
28
|
-
validates_presence_of :email, if: :email_required?
|
28
|
+
validates_presence_of :email, if: [:email_required?, :permanent_account?]
|
29
29
|
#validates_uniqueness_of :email, allow_blank: true, if: :email_changed?
|
30
|
-
validates_format_of :email, with: email_regexp, allow_blank: true, if: :email_changed?
|
30
|
+
validates_format_of :email, with: email_regexp, allow_blank: true, if: [:email_changed?, :permanent_account?]
|
31
31
|
|
32
32
|
validates_presence_of :password, if: :password_required?
|
33
33
|
validates_confirmation_of :password, if: :password_required?
|
data/lib/bpluser/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bpluser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Boston Public Library Web Services
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|