authentasaurus 0.6.12 → 0.6.14

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.
@@ -17,18 +17,18 @@ module ActiveRecord::Authenticatable
17
17
  validates_format_of :username, :with => /^[a-z0-9^ ]*([a-z0-9]{4})+[a-z0-9^ ]*$/ # alpha-numeric only and at least 4 characters
18
18
  validates_format_of :email, :with => %r{[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}}
19
19
  # password validations
20
- validates_confirmation_of :password, :on => :create
21
- validates_presence_of :password, :on => :create
22
- validates_length_of :password, :minimum => 6, :on => :create
20
+ validates_confirmation_of :password, :on => :create, :if => Proc.new {|user| user.hashed_password.nil? || user.password_seed.nil? }
21
+ validates_presence_of :password, :on => :create, :if => Proc.new {|user| user.hashed_password.nil? || user.password_seed.nil? }
22
+ validates_length_of :password, :minimum => 6, :on => :create, :if => Proc.new {|user| user.hashed_password.nil? || user.password_seed.nil? }
23
23
  # new password
24
24
  validates_confirmation_of :new_password, :on => :update, :unless => :new_password_blank?
25
25
  validates_length_of :new_password, :minimum => 6, :on => :update, :unless => :new_password_blank?
26
26
  # format of password
27
27
  if args.include?(:strong_password)
28
- validates_format_of :password, :with => %r{[a-z]}, :on => :create, :message => :"authenticatable.lower_case_password"
29
- validates_format_of :password, :with => %r{[A-Z]}, :on => :create, :message => :"authenticatable.upper_case_password"
30
- validates_format_of :password, :with => %r{[0-9]}, :on => :create, :message => :"authenticatable.digit_password"
31
- validates_format_of :password, :with => %r{[@$%!&]}, :on => :create, :message => :"authenticatable.symbol_password"
28
+ validates_format_of :password, :with => %r{[a-z]}, :on => :create, :message => :"authenticatable.lower_case_password", :if => Proc.new {|user| user.hashed_password.nil? || user.password_seed.nil? }
29
+ validates_format_of :password, :with => %r{[A-Z]}, :on => :create, :message => :"authenticatable.upper_case_password", :if => Proc.new {|user| user.hashed_password.nil? || user.password_seed.nil? }
30
+ validates_format_of :password, :with => %r{[0-9]}, :on => :create, :message => :"authenticatable.digit_password", :if => Proc.new {|user| user.hashed_password.nil? || user.password_seed.nil? }
31
+ validates_format_of :password, :with => %r{[@$%!&]}, :on => :create, :message => :"authenticatable.symbol_password", :if => Proc.new {|user| user.hashed_password.nil? || user.password_seed.nil? }
32
32
  # new password
33
33
  validates_format_of :new_password, :with => %r{[a-z]}, :on => :update, :message => :"authenticatable.lower_case_password", :unless => :new_password_blank?
34
34
  validates_format_of :new_password, :with => %r{[A-Z]}, :on => :update, :message => :"authenticatable.upper_case_password", :unless => :new_password_blank?
@@ -25,10 +25,10 @@ module ActiveResource::ActsAsAuthenticatable
25
25
  last_update_datetime = (last_update.kind_of?(String)) ? (DateTime.parse(last_update)) : (last_update)
26
26
 
27
27
  if local_user.updated_at < last_update_datetime
28
-
29
- local_user.update_attributes user.attributes
28
+ local_user.update_attributes user.attributes
30
29
  end
31
30
  else
31
+ local_user.attributes.merge(self.sync_to.try(:DEFAULT_DATA) || {})
32
32
  local_user.save
33
33
  end
34
34
  end
@@ -47,6 +47,7 @@ module ActiveResource::ActsAsAuthenticatable
47
47
  unless local_user.new_record?
48
48
  local_user.update_attributes user.attributes
49
49
  else
50
+ local_user.attributes.merge(self.sync_to.try(:DEFAULT_DATA) || {})
50
51
  local_user.save
51
52
  end
52
53
  else
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: authentasaurus
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
- - 12
10
- version: 0.6.12
9
+ - 14
10
+ version: 0.6.14
11
11
  platform: ruby
12
12
  authors:
13
13
  - Omar Mekky
@@ -18,7 +18,7 @@ autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
20
 
21
- date: 2010-08-20 00:00:00 +02:00
21
+ date: 2010-08-23 00:00:00 +02:00
22
22
  default_executable:
23
23
  dependencies: []
24
24