Improved reliability of ldap test (somewhat... it's still very environment specific).

Fixed validations in User model.
Updated environment.rb.tmpl to be a little easier to follow.

A note for upgraders. Be sure to include the following line in your environment.rb:

 AUTHENTICATION_SCHEMES = ['database']

See environment.rb.tmpl for details



git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@337 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
lukemelia 2006-11-06 07:32:48 +00:00
parent b57765486d
commit 4caca8db70
3 changed files with 32 additions and 4 deletions

View file

@ -56,10 +56,14 @@ protected
def crypt_password
write_attribute("password", self.class.sha1(password)) if password == @password_confirmation
end
def password_required?
auth_type == 'database'
end
validates_presence_of :login
validates_presence_of :password, :if => Proc.new{|user| user.auth_type == 'database'}
validates_length_of :password, :within => 5..40
validates_presence_of :password, :if => :password_required?
validates_length_of :password, :within => 5..40, :if => :password_required?
validates_confirmation_of :password
validates_length_of :login, :within => 3..80
validates_uniqueness_of :login, :on => :create