Adds a way for a registered user to get a new action email (#14228).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11946 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2013-06-09 10:01:56 +00:00
parent ec46d4315c
commit 4bd874ab46
7 changed files with 144 additions and 13 deletions
+3 -3
View File
@@ -157,7 +157,7 @@ class User < Principal
end
# Returns the user that matches provided login and password, or nil
def self.try_to_login(login, password)
def self.try_to_login(login, password, active_only=true)
login = login.to_s
password = password.to_s
@@ -166,8 +166,8 @@ class User < Principal
user = find_by_login(login)
if user
# user is already in local database
return nil unless user.active?
return nil unless user.check_password?(password)
return nil if !user.active? && active_only
else
# user is not yet registered, try to authenticate with available sources
attrs = AuthSource.authenticate(login, password)
@@ -181,7 +181,7 @@ class User < Principal
end
end
end
user.update_column(:last_login_on, Time.now) if user && !user.new_record?
user.update_column(:last_login_on, Time.now) if user && !user.new_record? && user.active?
user
rescue => text
raise text