diff --git a/app/models/user.rb b/app/models/user.rb index 8573645d..3a11b461 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -150,13 +150,25 @@ class User < ActiveRecord::Base return nil if login.blank? candidate = find(:first, :conditions => ["login = ?", login]) return nil if candidate.nil? - return candidate if candidate.auth_type == 'database' && candidate.crypted_password == sha1(pass) + + if Tracks::Config.auth_schemes.include?('database') + return candidate if candidate.auth_type == 'database' && candidate.crypted_password == sha1(pass) + end + if Tracks::Config.auth_schemes.include?('ldap') return candidate if candidate.auth_type == 'ldap' && SimpleLdapAuthenticator.valid?(login, pass) end - if Tracks::Config.auth_schemes.include?('cas') && candidate.auth_type.eql?("cas") - return candidate #because we can not auth them with out thier real password we have to settle for this + + if Tracks::Config.auth_schemes.include?('cas') + # because we can not auth them with out thier real password we have to settle for this + return candidate if candidate.auth_type.eql?("cas") end + + if Tracks::Config.auth_schemes.include?('open_id') + # hope the user enters the correct data + return candidate + end + return nil end diff --git a/app/views/layouts/login.html.erb b/app/views/layouts/login.html.erb index b550297c..a410966e 100644 --- a/app/views/layouts/login.html.erb +++ b/app/views/layouts/login.html.erb @@ -3,8 +3,7 @@
<%= stylesheet_link_tag "scaffold" %> - <%= javascript_include_tag 'jquery' %> - <%= javascript_include_tag 'jquery.cookie' %> + <%= javascript_include_tag 'jquery', 'jquery.cookie', 'jrails' %>| - | "<%= session[:cas_user]%>" | -- <%= hidden_field "user", "login", :value => session[:cas_user] %> - <%= hidden_field "user", "password", :value => session[:cas_user] %> - <%= hidden_field "user", "password_confirmation", :value => session[:cas_user] %> - <%= hidden_field"user", "auth_type", :value => "cas" %> | -
| + | "<%= session[:cas_user]%>" | ++ <%= hidden_field "user", "login", :value => session[:cas_user] %> + <%= hidden_field "user", "password", :value => session[:cas_user] %> + <%= hidden_field "user", "password_confirmation", :value => session[:cas_user] %> + <%= hidden_field"user", "auth_type", :value => "cas" %> | +
| - | <%= text_field "user", "login", :size => 20 %> | -|
| - | <%= password_field "user", "password", :size => 20 %> | -|
| - | <%= password_field "user", "password_confirmation", :size => 20 %> | -|
| - | <%= select("user", "auth_type", @auth_types, { :include_blank => false })%> | -|
| + | <%= text_field "user", "login", :size => 20 %> | +|
| + | <%= password_field "user", "password", :size => 20 %> | +|
| + | <%= password_field "user", "password_confirmation", :size => 20 %> | +|
| + | <%= text_field "user", "open_id_url", :class => "open_id" %> | +|
| + | <%= select("user", "auth_type", @auth_types, { :include_blank => false })%> | +|