From 901af95c692af89daeee632d679faf51c144c9e1 Mon Sep 17 00:00:00 2001 From: Erik Ordway Date: Wed, 30 Dec 2009 10:48:41 -0800 Subject: [PATCH] clean up debug code and get new user correct --- app/controllers/application_controller.rb | 5 +++-- app/views/login/login.html.erb | 2 -- app/views/users/new.html.erb | 13 ++++++------- config/site.yml.tmpl | 1 + lib/tracks/config.rb | 5 +++++ 5 files changed, 15 insertions(+), 11 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index fb4ee359..9f1fde94 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -42,6 +42,8 @@ class ApplicationController < ActionController::Base extend ActionView::Helpers::SanitizeHelper::ClassMethods helper_method :format_date, :markdown + I18n.locale = Tracks::Config.locale + # By default, sets the charset to UTF-8 if it isn't already set def set_charset headers["Content-Type"] ||= "text/html; charset=UTF-8" @@ -276,8 +278,7 @@ class ApplicationController < ActionController::Base def set_time_zone Time.zone = current_user.prefs.time_zone if logged_in? - locale = params[:locale] || 'en-US' - I18n.locale = locale + I18n.locale = Tracks::Config.locale end def set_zindex_counter diff --git a/app/views/login/login.html.erb b/app/views/login/login.html.erb index ee1665b3..b4a1dda5 100644 --- a/app/views/login/login.html.erb +++ b/app/views/login/login.html.erb @@ -9,8 +9,6 @@ <%= render_flash %>

Please log in to use Tracks:

-

auth method <%=cookies[:preferred_auth]%>

-

cas user<%=session[:cas_user]%>

<% if show_database_form %>
"> <% form_tag :action=> 'login' do %> diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb index aa72e800..3e19e07c 100644 --- a/app/views/users/new.html.erb +++ b/app/views/users/new.html.erb @@ -1,23 +1,22 @@
<% form_tag :action=> "create" do %> - <%= error_messages_for 'user' %>
+ <%#= error_messages_for 'user' %>
<%= render_flash %>

<%= @heading -%>

-
<%if Tracks::Config.auth_schemes.include?('cas') && session[:cas_user]%> - - - - - + <%else%> diff --git a/config/site.yml.tmpl b/config/site.yml.tmpl index 91389652..097ef9e1 100644 --- a/config/site.yml.tmpl +++ b/config/site.yml.tmpl @@ -25,6 +25,7 @@ authentication_schemes: # You''ll probably want to change this to the time zone of the computer where Tracks is running # run rake time:zones:local have Rails suggest time zone names on your system time_zone: "UTC" +locale: 'en-US' # setting this to true will make the cookies only available over HTTPS diff --git a/lib/tracks/config.rb b/lib/tracks/config.rb index 0ca04f97..cd5eca02 100644 --- a/lib/tracks/config.rb +++ b/lib/tracks/config.rb @@ -23,5 +23,10 @@ module Tracks auth_schemes.first end end + + def self.locale + SITE_CONFIG['locale'] || 'en-US' + end + end end \ No newline at end of file
"<%= session[:cas_user]%>"
<%= session[:cas_user]%>" <%= text_field "user", "login", :size => 20, :value => session[:cas_user], :readonly => true %> <%= password_field "user", "password", :size => 20 , :value => "fakebecauseweusecas" %><%= password_field "user", "password_confirmation", :size => 20, :value => "fakebecauseweusecas" %> + <%= 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" %>