bpluser 0.0.17 → 0.0.18

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
  SHA1:
3
- metadata.gz: eb775c6f5f9d7b6b08b89d81a52321b32f80afe7
4
- data.tar.gz: de3c3214f82ad04d79d7bde0a9040caddd985eca
3
+ metadata.gz: a184b0220732712ea2ca33ba036030b536d974e4
4
+ data.tar.gz: d85e0ab34d54d4886dd00837728f6abdb6ab5fa8
5
5
  SHA512:
6
- metadata.gz: 018fc293c23d773338eef2284ef556e50b0678079ce5810858dabfc3f454307e05cd694c3d34a8222a1d1fd6a694197d6534b7c96176b402df7c1b6e14c2a0bc
7
- data.tar.gz: 9bbce1dc2c4a2605be3402f887273290970872a759b55e63003957111b291c90e3af12ab4c4666ccc5b83e238b8eb6d61614cc0aac0a3d6cb6c4cd692d48d7a8
6
+ metadata.gz: 7a72efada4fce7d24dcd7481e523f606c0f4147c841a3c0bf818d1bfcc85d1002213f6bb069a79b871ba690089ac618fe9d1981bbea16b4aa14bbcdb2250a32c
7
+ data.tar.gz: 5d887691378eeac07aae08741e9e26d163ec0ba7fbeb8c0deefd9bf4475dcf95aa685462e3cf15a2eaea44af3f831b32df94725d4dbfd4f635e6dea88e999d58
@@ -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.extra.raw_info.name,
109
+ user = User.create(display_name:auth.full_name,
112
110
  uid:auth.uid,
113
111
  provider:auth.provider,
114
- username:auth.info.nickname,
115
- email:auth.info.email,
116
- password:Devise.friendly_token[0,20] ,
117
- first_name:auth.extra.raw_info.first_name,
118
- last_name:auth.extra.raw_info.last_name
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?
@@ -1,3 +1,3 @@
1
1
  module Bpluser
2
- VERSION = "0.0.17"
2
+ VERSION = "0.0.18"
3
3
  end
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.17
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-15 00:00:00.000000000 Z
11
+ date: 2016-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails