summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/models/user.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index 9b0ab8110..9ac5a4fd0 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -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?