summaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2013-02-14 22:13:49 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2013-02-14 22:13:49 +0000
commit3c3ac3c6eeba2fa206cdee0ea184bd28eba67ea7 (patch)
tree09ecdb3d119d87c95b1bba8bb1a0e431cd1172c3 /app/models
parent812da860b376d857fc7f1c4b06b26c6bec9232f7 (diff)
downloadredmine-3c3ac3c6eeba2fa206cdee0ea184bd28eba67ea7.tar.gz
redmine-3c3ac3c6eeba2fa206cdee0ea184bd28eba67ea7.zip
Code cleanup.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11375 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models')
-rw-r--r--app/models/user.rb14
1 files changed, 4 insertions, 10 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index e97d01a7c..696a2a203 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -156,19 +156,13 @@ class User < Principal
login = login.to_s
password = password.to_s
- # Make sure no one can sign in with an empty password
- return nil if password.empty?
+ # Make sure no one can sign in with an empty login or password
+ return nil if login.empty? || password.empty?
user = find_by_login(login)
if user
# user is already in local database
- return nil if !user.active?
- if user.auth_source
- # user has an external authentication method
- return nil unless user.auth_source.authenticate(login, password)
- else
- # authentication with local password
- return nil unless user.check_password?(password)
- end
+ return nil unless user.active?
+ return nil unless user.check_password?(password)
else
# user is not yet registered, try to authenticate with available sources
attrs = AuthSource.authenticate(login, password)