]> git.openstreetmap.org Git - rails.git/commitdiff
Tell users if the reason they can't login is because they haven't activated
authorTom Hughes <tom@compton.nu>
Mon, 18 Jun 2007 07:27:39 +0000 (07:27 +0000)
committerTom Hughes <tom@compton.nu>
Mon, 18 Jun 2007 07:27:39 +0000 (07:27 +0000)
their account yet.

app/controllers/user_controller.rb
app/models/user.rb

index f01157bc011fd3afa5ee9313faadef422172c7c0..998a636c1b11f6d1853d9b62771d901fe7ed78e8 100644 (file)
@@ -116,6 +116,8 @@ class UserController < ApplicationController
           redirect_to :controller => 'site', :action => 'index'
         end
         return
+      elsif User.authenticate(email, pass, false)
+        flash[:notice] = "Sorry, your account is not active yet.<br>Please click on the link in the account confirmation email to activate your account."
       else
         flash[:notice] = "Sorry, couldn't log in with those details."
       end
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)