diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-07-19 10:47:19 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-07-19 10:47:19 +0000 |
commit | eb1d969237a9ed1bb41c6e10d5a9eb073f297e95 (patch) | |
tree | 53f88db3c4e26b74979f3d16626ed066cb7f77ae /app/models/auth_source_ldap.rb | |
parent | 93201e7386eb8bb2c69f110d934f04feb81ffe93 (diff) | |
download | redmine-eb1d969237a9ed1bb41c6e10d5a9eb073f297e95.tar.gz redmine-eb1d969237a9ed1bb41c6e10d5a9eb073f297e95.zip |
Improved on-the-fly account creation. If some attributes are missing (eg. not present in the LDAP) or are invalid, the registration form is displayed so that the user is able to fill or fix these attributes.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1678 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/auth_source_ldap.rb')
-rw-r--r-- | app/models/auth_source_ldap.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/app/models/auth_source_ldap.rb b/app/models/auth_source_ldap.rb index a438bd3c7..655ffd6d5 100644 --- a/app/models/auth_source_ldap.rb +++ b/app/models/auth_source_ldap.rb @@ -20,7 +20,10 @@ require 'iconv' class AuthSourceLdap < AuthSource validates_presence_of :host, :port, :attr_login - validates_presence_of :attr_firstname, :attr_lastname, :attr_mail, :if => Proc.new { |a| a.onthefly_register? } + validates_length_of :name, :host, :account_password, :maximum => 60, :allow_nil => true + validates_length_of :account, :base_dn, :maximum => 255, :allow_nil => true + validates_length_of :attr_login, :attr_firstname, :attr_lastname, :attr_mail, :maximum => 30, :allow_nil => true + validates_numericality_of :port, :only_integer => true def after_initialize self.port = 389 if self.port == 0 |