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' %> <%= @page_title -%> diff --git a/app/views/layouts/standard.html.erb b/app/views/layouts/standard.html.erb index 160af2aa..45e832ff 100644 --- a/app/views/layouts/standard.html.erb +++ b/app/views/layouts/standard.html.erb @@ -2,14 +2,10 @@ - <%= stylesheet_link_tag 'standard','superfish','niftyCorners','jquery-ui', - 'jquery.autocomplete', :cache => true %> + <%= stylesheet_link_tag 'standard','superfish','niftyCorners','jquery-ui', 'jquery.autocomplete', :cache => true %> <%= stylesheet_link_tag "print", :media => "print" %> - <%= javascript_include_tag 'jquery','jquery-ui','jquery.cookie', - 'jquery.blockUI','jquery.jeditable','jquery.autocomplete', - 'jquery.truncator', :cache => 'jquery-all' %> - <%= javascript_include_tag 'hoverIntent','superfish','application', - 'accesskey-hints','niftycube','swfobject', :cache => 'tracks' %> + <%= javascript_include_tag 'jquery','jquery-ui','jquery.cookie', 'jquery.blockUI','jquery.jeditable','jquery.autocomplete', 'jquery.truncator', 'jrails', :cache => 'jquery-all' %> + <%= javascript_include_tag 'hoverIntent','superfish','application', 'accesskey-hints','niftycube','swfobject', :cache => 'tracks' %> <%= javascript_tag "var AUTH_TOKEN = #{form_authenticity_token.inspect};" if protect_against_forgery? %> <%= javascript_tag "var SOURCE_VIEW = '#{@source_view}';" %> <%= javascript_tag "var TAG_NAME = '#{@tag_name}';" if @tag_name %> diff --git a/app/views/users/change_auth_type.html.erb b/app/views/users/change_auth_type.html.erb index 121355fb..e822bfe8 100644 --- a/app/views/users/change_auth_type.html.erb +++ b/app/views/users/change_auth_type.html.erb @@ -11,7 +11,7 @@
<%= submit_tag t('users.auth_change_submit') %> <%= link_to t('common.cancel'), preferences_path %>
- <%= observe_field( :user_auth_type, :function => "$('open_id').style.display = value == 'open_id' ? 'block' : 'none'") %> + <%= observe_field( :user_auth_type, :function => "$('#open_id')[0].style.display = value == 'open_id' ? 'block' : 'none'") %> <% end %> diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb index ddad7109..a89ee5d0 100644 --- a/app/views/users/new.html.erb +++ b/app/views/users/new.html.erb @@ -9,32 +9,37 @@ <%if Tracks::Config.auth_schemes.include?('cas') && session[:cas_user]%> - - - - - + + + + + <%else%> - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + <%= observe_field( :user_auth_type, :function => "$('#open_id')[0].style.display = value == 'open_id' ? 'table-row' : 'none'") %> <%end%>
"<%= 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 })%>