summaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2013-06-09 10:01:56 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2013-06-09 10:01:56 +0000
commit4bd874ab46c38792f9e834d28a17ed5eabde9d61 (patch)
tree769a659b66782e7ce8a14c0c87f2d624237a2875 /app/models
parentec46d4315c2ba4989fb355fd6722bd09b96c6d41 (diff)
downloadredmine-4bd874ab46c38792f9e834d28a17ed5eabde9d61.tar.gz
redmine-4bd874ab46c38792f9e834d28a17ed5eabde9d61.zip
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
Diffstat (limited to 'app/models')
-rw-r--r--app/models/user.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index 738554d85..8ad717042 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -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