##// END OF EJS Templates
Rails3: model: replace deprecated 'validate' method at User model...
Toshi MARUYAMA -
r7311:7e017e6c2cc5
parent child
Show More
@@ -72,6 +72,7 class User < Principal
72 validates_length_of :mail, :maximum => 60, :allow_nil => true
72 validates_length_of :mail, :maximum => 60, :allow_nil => true
73 validates_confirmation_of :password, :allow_nil => true
73 validates_confirmation_of :password, :allow_nil => true
74 validates_inclusion_of :mail_notification, :in => MAIL_NOTIFICATION_OPTIONS.collect(&:first), :allow_blank => true
74 validates_inclusion_of :mail_notification, :in => MAIL_NOTIFICATION_OPTIONS.collect(&:first), :allow_blank => true
75 validate :validate_password_length
75
76
76 before_create :set_mail_notification
77 before_create :set_mail_notification
77 before_save :update_hashed_password
78 before_save :update_hashed_password
@@ -546,7 +547,7 class User < Principal
546
547
547 protected
548 protected
548
549
549 def validate
550 def validate_password_length
550 # Password length validation based on setting
551 # Password length validation based on setting
551 if !password.nil? && password.size < Setting.password_min_length.to_i
552 if !password.nil? && password.size < Setting.password_min_length.to_i
552 errors.add(:password, :too_short, :count => Setting.password_min_length.to_i)
553 errors.add(:password, :too_short, :count => Setting.password_min_length.to_i)
General Comments 0
You need to be logged in to leave comments. Login now