Tell users if the reason they can't login is because they haven't activated
their account yet.
This commit is contained in:
parent
0e66875ace
commit
8c8d55736f
2 changed files with 4 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue