Implements the behaviour expected in user_test.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9029 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
c0048f7954
commit
df3c2466f8
|
@ -132,7 +132,8 @@ class User < Principal
|
|||
def self.try_to_login(login, password)
|
||||
# Make sure no one can sign in with an empty password
|
||||
return nil if password.to_s.empty?
|
||||
user = find_by_login(login)
|
||||
matches = find_all_by_login(login)
|
||||
user = (matches.size < 2 ? matches.first : matches.detect {|u| u.login == login})
|
||||
if user
|
||||
# user is already in local database
|
||||
return nil if !user.active?
|
||||
|
|
Loading…
Reference in New Issue