From 8c8d55736f31d91454385990b690d26afafbf6f5 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Mon, 18 Jun 2007 07:27:39 +0000 Subject: [PATCH] Tell users if the reason they can't login is because they haven't activated their account yet. --- app/controllers/user_controller.rb | 2 ++ app/models/user.rb | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index f01157bc0..998a636c1 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -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.
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 diff --git a/app/models/user.rb b/app/models/user.rb index da4d4c205..92d47d5ff 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -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) -- 2.43.2