has_many :email_addresses, :dependent => :delete_all
belongs_to :auth_source
- scope :logged, lambda { where("#{User.table_name}.status <> #{STATUS_ANONYMOUS}") }
- scope :status, lambda {|arg| where(arg.blank? ? nil : {:status => arg.to_i}) }
+ scope :logged, lambda {where("#{User.table_name}.status <> #{STATUS_ANONYMOUS}")}
+ scope :status, lambda {|arg| where(arg.blank? ? nil : {:status => arg.to_i})}
acts_as_customizable
LOGIN_LENGTH_LIMIT = 60
MAIL_LENGTH_LIMIT = 60
- validates_presence_of :login, :firstname, :lastname, :if => Proc.new { |user| !user.is_a?(AnonymousUser) }
- validates_uniqueness_of :login, :if => Proc.new { |user| user.login_changed? && user.login.present? }, :case_sensitive => false
+ validates_presence_of :login, :firstname, :lastname, :if => Proc.new {|user| !user.is_a?(AnonymousUser)}
+ validates_uniqueness_of :login, :if => Proc.new {|user| user.login_changed? && user.login.present?}, :case_sensitive => false
# Login must contain letters, numbers, underscores only
validates_format_of :login, :with => /\A[a-z0-9_\-@\.]*\z/i
validates_length_of :login, :maximum => LOGIN_LENGTH_LIMIT
length -= 1
end
chars = chars_list.flatten
- length.times { password << chars[SecureRandom.random_number(chars.size)] }
+ length.times {password << chars[SecureRandom.random_number(chars.size)]}
password = password.split('').shuffle(random: SecureRandom).join
self.password = password
self.password_confirmation = password