fixing some stuff around OpenID:

- adding missing Javascript includes
	- fixing jquery for showing/hiding indentity url field
	- adding identity url field to signup form
	- fixing bug in signup controller
This commit is contained in:
Stefan Richter 2011-01-20 07:33:39 +08:00 committed by Reinier Balt
parent eb22178b67
commit 1c90b90909
5 changed files with 50 additions and 38 deletions

View file

@ -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

View file

@ -3,8 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<%= stylesheet_link_tag "scaffold" %>
<%= javascript_include_tag 'jquery' %>
<%= javascript_include_tag 'jquery.cookie' %>
<%= javascript_include_tag 'jquery', 'jquery.cookie', 'jrails' %>
<title><%= @page_title -%></title>

View file

@ -2,14 +2,10 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<%= 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 %>

View file

@ -11,7 +11,7 @@
<div id="open_id" style="display:<%= current_user.auth_type == 'open_id' ? 'block' : 'none' %>"><label for="openid_url"><%= t('users.identity_url') %>:</label> <input type="text" name="openid_url" value="<%= current_user.open_id_url %>" class="open_id" /></div>
<div class="actions"><%= submit_tag t('users.auth_change_submit') %> <%= link_to t('common.cancel'), preferences_path %></div>
<%= 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 %>

View file

@ -9,32 +9,37 @@
<table>
<%if Tracks::Config.auth_schemes.include?('cas') && session[:cas_user]%>
<tr>
<td><label for="user_login"><%= t('users.register_with_cas') %>:</label></td>
<td> "<%= session[:cas_user]%>" </td>
<td>
<%= 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" %></td>
</tr>
<tr>
<td><label for="user_login"><%= t('users.register_with_cas') %>:</label></td>
<td> "<%= session[:cas_user]%>" </td>
<td>
<%= 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" %></td>
</tr>
<%else%>
<tr>
<td><label for="user_login"><%= t('users.desired_login') %>:</label></td>
<td> <%= text_field "user", "login", :size => 20 %></td>
</tr>
<tr>
<td><label for="user_password"><%= t('users.choose_password') %>:</label></td>
<td><%= password_field "user", "password", :size => 20 %></td>
</tr>
<tr>
<td><label for="user_password_confirmation"><%= t('users.confirm_password') %>:</label></td>
<td><%= password_field "user", "password_confirmation", :size => 20 %></td>
</tr>
<tr>
<td><label for="user_auth_type"><%= User.human_attribute_name('auth_type') %>:</label></td>
<td><%= select("user", "auth_type", @auth_types, { :include_blank => false })%></td>
</tr>
<tr>
<td><label for="user_login"><%= t('users.desired_login') %>:</label></td>
<td> <%= text_field "user", "login", :size => 20 %></td>
</tr>
<tr>
<td><label for="user_password"><%= t('users.choose_password') %>:</label></td>
<td><%= password_field "user", "password", :size => 20 %></td>
</tr>
<tr>
<td><label for="user_password_confirmation"><%= t('users.confirm_password') %>:</label></td>
<td><%= password_field "user", "password_confirmation", :size => 20 %></td>
</tr>
<tr id="open_id" style="display:<%= @user.auth_type == 'open_id' ? 'table-row' : 'none' %>">
<td><label for="openid_url"><%= t('users.identity_url') %>:</label></td>
<td><%= text_field "user", "open_id_url", :class => "open_id" %></td>
</tr>
<tr>
<td><label for="user_auth_type"><%= User.human_attribute_name('auth_type') %>:</label></td>
<td><%= select("user", "auth_type", @auth_types, { :include_blank => false })%></td>
</tr>
<%= observe_field( :user_auth_type, :function => "$('#open_id')[0].style.display = value == 'open_id' ? 'table-row' : 'none'") %>
<%end%>
<tr>
<td></td>