Skip to content

Commit

Permalink
Added comments about OpenID specifics
Browse files Browse the repository at this point in the history
  • Loading branch information
binarylogic committed Nov 24, 2008
1 parent cb140c2 commit 895f26a
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 3 deletions.
2 changes: 2 additions & 0 deletions 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
Expand Down
2 changes: 2 additions & 0 deletions 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?
Expand Down
6 changes: 6 additions & 0 deletions app/views/user_sessions/new.html.erb
Expand Up @@ -9,6 +9,12 @@
<%= f.label :password %><br />
<%= f.password_field :password %><br />
</div>
<!--
Notice the following is for OpenID. If you are not implementing OpenID in your app, simply remove the following <div> block.
Also, notice the <div id="login_container"> above, those fields do not need to be wrapped in a <div>, you can remove that as well.
I apologize if this makes it a little confusing, I have been building this app with a number of tutorials and one of them has been
OpenID integration.
-->
<div id="openid_container"<% if @user_session.openid_identifier.blank? %> 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();" %>)<br /><br />
<%= f.text_field :openid_identifier %><br />
Expand Down
4 changes: 4 additions & 0 deletions app/views/users/_form.erb
Expand Up @@ -7,6 +7,10 @@
<%= form.label :password_confirmation %><br />
<%= form.password_field :password_confirmation %><br />
<br />
<!--
The following is for OpenID integration, if you are not using OpenID in your app
simple remove the :openid_identifier label and field
-->
<%= form.label :openid_identifier, "Or use OpenID instead of a standard login / password" %><br />
<%= form.text_field :openid_identifier %><br />
<br />
Expand Down
4 changes: 4 additions & 0 deletions app/views/users/show.html.erb
@@ -1,3 +1,7 @@
<!--
The following is for OpenID, if you are not using OpenID in your app remove
the OpenID if statement and field below.
-->
<% if @user.openid_identifier.blank? %>
<p>
<b>Login:</b>
Expand Down
6 changes: 3 additions & 3 deletions config/environment.rb
Expand Up @@ -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 )
Expand Down

0 comments on commit 895f26a

Please sign in to comment.