diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-02-05 11:50:53 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-02-05 11:50:53 +0000 |
commit | a00f04886fac78e489bb030d20414ebdf10841e3 (patch) | |
tree | 91d304c1be59bd251afb54143c288eebef2ed1e4 /app/models/user.rb | |
parent | 1d4ef8964def4ecbe7a11485f72d7fbe61c55724 (diff) | |
download | redmine-a00f04886fac78e489bb030d20414ebdf10841e3.tar.gz redmine-a00f04886fac78e489bb030d20414ebdf10841e3.zip |
Increase username length limit from 30 to 60 (#2719).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8778 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/user.rb')
-rw-r--r-- | app/models/user.rb | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index 9be6143dc..02aecd341 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -71,16 +71,19 @@ class User < Principal attr_accessor :last_before_login_on # Prevents unauthorized assignments attr_protected :login, :admin, :password, :password_confirmation, :hashed_password - + + LOGIN_LENGTH_LIMIT = 60 + MAIL_LENGTH_LIMIT = 60 + validates_presence_of :login, :firstname, :lastname, :mail, :if => Proc.new { |user| !user.is_a?(AnonymousUser) } validates_uniqueness_of :login, :if => Proc.new { |user| !user.login.blank? }, :case_sensitive => false validates_uniqueness_of :mail, :if => Proc.new { |user| !user.mail.blank? }, :case_sensitive => false # Login must contain lettres, numbers, underscores only validates_format_of :login, :with => /^[a-z0-9_\-@\.]*$/i - validates_length_of :login, :maximum => 30 + validates_length_of :login, :maximum => LOGIN_LENGTH_LIMIT validates_length_of :firstname, :lastname, :maximum => 30 validates_format_of :mail, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i, :allow_blank => true - validates_length_of :mail, :maximum => 60, :allow_nil => true + validates_length_of :mail, :maximum => MAIL_LENGTH_LIMIT, :allow_nil => true validates_confirmation_of :password, :allow_nil => true validates_inclusion_of :mail_notification, :in => MAIL_NOTIFICATION_OPTIONS.collect(&:first), :allow_blank => true validate :validate_password_length |