diff --git a/tracks/app/views/layouts/login.rhtml b/tracks/app/views/layouts/login.rhtml index e124c2bc..3e30e8f0 100644 --- a/tracks/app/views/layouts/login.rhtml +++ b/tracks/app/views/layouts/login.rhtml @@ -4,14 +4,7 @@ <%= stylesheet_link_tag "scaffold" %> <%= javascript_include_tag :defaults %> - + <%= @page_title -%> diff --git a/tracks/app/views/login/login.rhtml b/tracks/app/views/login/login.rhtml index f10bc677..317b7d69 100644 --- a/tracks/app/views/login/login.rhtml +++ b/tracks/app/views/login/login.rhtml @@ -1,52 +1,78 @@ -<% auth_schemes = Tracks::Config.auth_schemes -%> +<% auth_schemes = Tracks::Config.auth_schemes + show_database_form = auth_schemes.include?('database') + show_openid_form = auth_schemes.include?('open_id') +-%> +
<%= render_flash %>

Please log in to use Tracks:

- <% if auth_schemes.include?('database') || auth_schemes.include?('open_id') %> - <% form_tag :action=> 'login' do %> - - - - - - - - - - - - - - - - - -
- <% end %> - <% end %> +<% if show_database_form %> +
+ <% form_tag :action=> 'login' do %> + + + + + + + + + + + + + + + + + +
+ <% end %> +
+<% end %> - <% if auth_schemes.include?('open_id') %> - <% form_tag :action=> 'login', :action => 'begin' do %> - - - - - - - - - - - - - -
- <% end %> - <% end %> - +<% if show_openid_form %> + + <% end %> +
+<% if show_openid_form %>

or, login with an OpenId

<% end %> +<% if show_database_form %>

or, go back to the standard login

<% end %> - + \ No newline at end of file diff --git a/tracks/public/javascripts/application.js b/tracks/public/javascripts/application.js index 7ade0bde..e194cd8d 100644 --- a/tracks/public/javascripts/application.js +++ b/tracks/public/javascripts/application.js @@ -1,3 +1,25 @@ +var Login = { + showOpenid: function() { + if ($('database_auth_form')) $('database_auth_form').hide(); + if ($('openid_auth_form')) $('openid_auth_form').show(); + if ($('alternate_auth_openid')) $('alternate_auth_openid').hide(); + if ($('alternate_auth_database')) $('alternate_auth_database').show(); + if ($('openid_url')) $('openid_url').focus(); + if ($('openid_url')) $('openid_url').select(); + new CookieManager().setCookie('preferred_auth', 'openid'); + }, + + showDatabase: function(container) { + if ($('openid_auth_form')) $('openid_auth_form').hide(); + if ($('database_auth_form')) $('database_auth_form').show(); + if ($('alternate_auth_database')) $('alternate_auth_database').hide(); + if ($('alternate_auth_openid')) $('alternate_auth_openid').show(); + if ($('user_login')) $('user_login').focus(); + if ($('user_login')) $('user_login').select(); + new CookieManager().setCookie('preferred_auth', 'database'); + } +} + Ajax.Responders.register({ onCreate: function() { if($('busy') && Ajax.activeRequestCount>0) diff --git a/tracks/public/stylesheets/scaffold.css b/tracks/public/stylesheets/scaffold.css index eca0c9dc..060a372a 100644 --- a/tracks/public/stylesheets/scaffold.css +++ b/tracks/public/stylesheets/scaffold.css @@ -46,7 +46,7 @@ td {background-color: #ff9;} div.form { width: 350px; - margin: 100px auto; + margin: 100px auto 10px auto; padding: 10px; border: 1px solid #999; background: #ff9; @@ -153,4 +153,10 @@ input.open_id { color: #000; padding-left: 18px; width:182px; -} \ No newline at end of file +} +p.alternate_auth { + text-align:center; +} +p.alternate_auth a { + text-decoration:underline; +}