Tell users if the reason they can't login is because they haven't activated
[rails.git] / app / models / user.rb
index da4d4c2058b1429485327956f1f87c4e5692d851..92d47d5ffab5e88117738f94b60fd596510c2d18 100644 (file)
@@ -27,8 +27,8 @@ class User < ActiveRecord::Base
     self.pass_crypt = Digest::MD5.hexdigest(pass_crypt) unless pass_crypt_confirmation.nil?
   end
 
-  def self.authenticate(email, passwd)
-    find(:first, :conditions => [ "email = ? AND pass_crypt = ? AND active = true", email, Digest::MD5.hexdigest(passwd)])
+  def self.authenticate(email, passwd, active = true)
+    find(:first, :conditions => [ "email = ? AND pass_crypt = ? AND active = ?", email, Digest::MD5.hexdigest(passwd), active])
   end 
 
   def self.authenticate_token(token)