From 895f26ab7d601a2d9f57c8d17ccfc4f9277cae72 Mon Sep 17 00:00:00 2001 From: binarylogic Date: Mon, 24 Nov 2008 16:08:17 -0500 Subject: [PATCH] Added comments about OpenID specifics --- app/models/user.rb | 2 ++ app/models/user_session.rb | 2 ++ app/views/user_sessions/new.html.erb | 6 ++++++ app/views/users/_form.erb | 4 ++++ app/views/users/show.html.erb | 4 ++++ config/environment.rb | 6 +++--- 6 files changed, 21 insertions(+), 3 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index 128f6b0..f9dfa81 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,4 +1,6 @@ class User < ActiveRecord::Base + # ALL of the following code is for OpenID integration. If you are not using OpenID in your app + # just remove all of the following code, to the point where you User class is completely blank. acts_as_authentic :login_field_validation_options => {:if => :openid_identifier_blank?}, :password_field_validation_options => {:if => :openid_identifier_blank?} validate :normalize_openid_identifier diff --git a/app/models/user_session.rb b/app/models/user_session.rb index 3c9bc64..ccea335 100644 --- a/app/models/user_session.rb +++ b/app/models/user_session.rb @@ -1,4 +1,6 @@ class UserSession < Authlogic::Session::Base + # ALL of the following code is for OpenID integration. If you are not using OpenID in your app + # just remove all of the following code, to the point where you UserSession class is completely blank. attr_accessor :openid_identifier def authenticating_with_openid? diff --git a/app/views/user_sessions/new.html.erb b/app/views/user_sessions/new.html.erb index 44ccece..26b01af 100644 --- a/app/views/user_sessions/new.html.erb +++ b/app/views/user_sessions/new.html.erb @@ -9,6 +9,12 @@ <%= f.label :password %>
<%= f.password_field :password %>
+
style="display: none;"<% end %>> <%= f.label :openid_identifier, "OpenID" %> (or <%= link_to_function "login using a standard username / password", "$('login_container').toggle(); $('openid_container').toggle();" %>)

<%= f.text_field :openid_identifier %>
diff --git a/app/views/users/_form.erb b/app/views/users/_form.erb index 77ba6d9..198867b 100644 --- a/app/views/users/_form.erb +++ b/app/views/users/_form.erb @@ -7,6 +7,10 @@ <%= form.label :password_confirmation %>
<%= form.password_field :password_confirmation %>

+ <%= form.label :openid_identifier, "Or use OpenID instead of a standard login / password" %>
<%= form.text_field :openid_identifier %>

diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index fdc3ce5..10d7289 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -1,3 +1,7 @@ + <% if @user.openid_identifier.blank? %>

Login: diff --git a/config/environment.rb b/config/environment.rb index 2191832..3d4f772 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -25,14 +25,14 @@ # config.gem "bj" # config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net" # config.gem "aws-s3", :lib => "aws/s3" - config.gem "authlogic" + #config.gem "authlogic" # Only load the plugins named here, in the order given. By default, all plugins # in vendor/plugins are loaded in alphabetical order. # :all can be used as a placeholder for all plugins not explicitly named # config.plugins = [ :exception_notification, :ssl_requirement, :all ] - #config.plugin_paths += ["#{RAILS_ROOT}/../../Libs"] - #config.plugins = [:authlogic, :open_id_authentication] + config.plugin_paths += ["#{RAILS_ROOT}/../../Libs"] + config.plugins = [:authlogic, :open_id_authentication] # Add additional load paths for your own custom dirs # config.load_paths += %W( #{RAILS_ROOT}/extras )