1
0
mirror of https://github.com/meineerde/redmine.git synced 2025-12-22 08:21:14 +00:00

remove spaces inside {} of app/models/user.rb

git-svn-id: http://svn.redmine.org/redmine/trunk@19879 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2020-07-11 01:21:19 +00:00
parent 0bee73f299
commit 8402e08034

View File

@ -92,8 +92,8 @@ class User < Principal
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
@ -104,8 +104,8 @@ class User < Principal
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
@ -384,7 +384,7 @@ class User < Principal
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