From: Tom Hughes Date: Mon, 18 Jun 2007 07:27:39 +0000 (+0000) Subject: Tell users if the reason they can't login is because they haven't activated X-Git-Tag: live~8364 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/8c8d55736f31d91454385990b690d26afafbf6f5?ds=sidebyside Tell users if the reason they can't login is because they haven't activated their account yet. --- 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)