mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-18 08:10:13 +01:00
Cleaned up logic in User#autheticate.
git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@657 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
parent
9179dbd16e
commit
bfb51dd472
1 changed files with 4 additions and 5 deletions
|
|
@ -108,12 +108,11 @@ class User < ActiveRecord::Base
|
||||||
return nil if login.blank?
|
return nil if login.blank?
|
||||||
candidate = find(:first, :conditions => ["login = ?", login])
|
candidate = find(:first, :conditions => ["login = ?", login])
|
||||||
return nil if candidate.nil?
|
return nil if candidate.nil?
|
||||||
if candidate.auth_type == 'database'
|
return candidate if candidate.auth_type == 'database' && candidate.crypted_password == sha1(pass)
|
||||||
return candidate if candidate.crypted_password == sha1(pass)
|
if Tracks::Config.auth_schemes.include?('ldap')
|
||||||
elsif candidate.auth_type == 'ldap' && Tracks::Config.auth_schemes.include?('ldap')
|
return candidate if candidate.auth_type == 'ldap' && SimpleLdapAuthenticator.valid?(login, pass)
|
||||||
return candidate if SimpleLdapAuthenticator.valid?(login, pass)
|
|
||||||
end
|
end
|
||||||
nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.find_by_open_id_url(raw_open_id_url)
|
def self.find_by_open_id_url(raw_open_id_url)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue