Feature #6166 » feature-6166.diff
| app/models/user.rb (working copy) | ||
|---|---|---|
|
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_format_of :login, :with => /\A[[:alnum:]_\-@\.]*\z/i
|
||
|
validates_length_of :login, :maximum => LOGIN_LENGTH_LIMIT
|
||
|
validates_length_of :firstname, :lastname, :maximum => 30
|
||
|
validates_inclusion_of :mail_notification, :in => MAIL_NOTIFICATION_OPTIONS.collect(&:first), :allow_blank => true
|
||
| test/unit/user_test.rb (working copy) | ||
|---|---|---|
|
assert user.save
|
||
|
end
|
||
|
def test_login_with_umlauts
|
||
|
user = User.new(:firstname => "new", :lastname => "user", :mail => "newuser@somenet.foo")
|
||
|
user.login = "Jörg"
|
||
|
assert user.valid?
|
||
|
assert user.save
|
||
|
end
|
||
|
def test_generate_password_should_respect_minimum_password_length
|
||
|
with_settings :password_min_length => 15 do
|
||
|
user = User.generate!(:generate_password => true)
|
||
- « Previous
- 1
- 2
- Next »