<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -8,7 +8,55 @@ class SessionsController &lt; ApplicationController
   end
 
   def create
-    person = Person.authenticate(params[:email], params[:password])
+    if using_open_id?
+      open_id_authentication(params[:openid_url])
+    else
+      password_authentication(params[:login],params[:password])
+    end
+  end
+
+  def open_id_authentication(openid_url)
+    authenticate_with_open_id(openid_url, :required =&gt; [:nickname, :email]) do |result, identity_url, registration|
+      if result.successful?
+        @person = Person.find_or_initialize_by_identity_url(identity_url)
+        if @person.new_record?
+          @person.name = registration['nickname']
+          @person.email = registration['email']
+          @person.save
+          if @person.errors.empty?
+            self.current_person = @person
+            successful_login
+          else
+            @body = &quot;login single-col&quot;
+            err_message = &quot;Your OpenID profile must provide&quot;
+            err_message += &quot; nickname,&quot; if !@person.errors[:name].nil?
+            err_message += &quot; email,&quot; if !@person.errors[:email].nil?
+
+            failed_login err_message.chop
+          end
+        end
+      else
+        failed_login result.message
+      end
+    end
+  end
+
+  def failed_login(message = &quot;Authentication failed.&quot;)
+    flash.now[:error] = message
+    render :action =&gt; 'new'
+  end
+  
+  def successful_login
+    if params[:remember_me] == &quot;1&quot;
+      self.current_person.remember_me
+      cookies[:auth_token] = { :value =&gt; self.current_person.remember_token , :expires =&gt; self.current_person.remember_token_expires_at }
+    end
+    redirect_back_or_default('/')
+    flash[:notice] = &quot;Logged in successfully&quot;
+  end
+
+  def password_authentication(login, password)
+    person = Person.authenticate(login, password)
     unless person.nil?
       if person.deactivated?
         flash[:error] = &quot;Your account has been deactivated&quot;</diff>
      <filename>app/controllers/sessions_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -35,7 +35,7 @@ class Person &lt; ActiveRecord::Base
   attr_accessible :email, :password, :password_confirmation, :name,
                   :description, :connection_notifications,
                   :message_notifications, :wall_comment_notifications,
-                  :blog_comment_notifications
+                  :blog_comment_notifications, :identity_url
   # Indexed fields for Sphinx
   is_indexed :fields =&gt; [ 'name', 'description', 'deactivated',
                           'email_verified'],
@@ -391,6 +391,7 @@ class Person &lt; ActiveRecord::Base
     end
 
     def log_activity_description_changed
+      debugger
       unless @old_description == description or description.blank?
         add_activities(:item =&gt; self, :person =&gt; self)
       end
@@ -418,7 +419,7 @@ class Person &lt; ActiveRecord::Base
     ## Other private method(s)
 
     def password_required?
-      crypted_password.blank? || !password.blank? || !verify_password.nil?
+      (crypted_password.blank? &amp;&amp; identity_url.nil?) || !password.blank? || !verify_password.nil?
     end
     
     class &lt;&lt; self</diff>
      <filename>app/models/person.rb</filename>
    </modified>
    <modified>
      <diff>@@ -40,4 +40,4 @@
     &lt;%= submit_tag 'Sign up', :class =&gt; &quot;button&quot; %&gt;
   &lt;/div&gt;
   &lt;% end %&gt;
-&lt;%- end -%&gt;
\ No newline at end of file
+&lt;%- end -%&gt;</diff>
      <filename>app/views/people/new.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -15,6 +15,15 @@
                                          :maxlength =&gt; Person::MAX_PASSWORD %&gt;
     &lt;/div&gt;
 
+    &lt;p&gt;
+      or use...
+    &lt;/p&gt;
+
+    &lt;div class=&quot;form_row&quot;&gt;
+      &lt;label for=&quot;openid_url&quot;&gt;OpenID&lt;/label&gt;
+      &lt;%= text_field_tag &quot;openid_url&quot; %&gt;
+    &lt;/div&gt;
+
     &lt;div class=&quot;form_row&quot;&gt;
       &lt;label for=&quot;remember_me&quot; class=&quot;checkbox&quot;&gt;Remember me:&lt;/label&gt;
       &lt;%= check_box_tag 'remember_me', '1', true, :class =&gt; &quot;checkbox&quot; %&gt;
@@ -29,4 +38,4 @@
       &lt;%= link_to &quot;I forgot my password!&quot;, new_password_reminder_path %&gt;
     &lt;/p&gt;
   &lt;% end -%&gt;
-&lt;%- end -%&gt;
\ No newline at end of file
+&lt;%- end -%&gt;</diff>
      <filename>app/views/sessions/new.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -16,4 +16,4 @@ config.action_controller.perform_caching             = false
 # Don't care if the mailer can't send
 config.action_mailer.raise_delivery_errors = false
 
-config.active_record.colorize_logging = true
\ No newline at end of file
+config.active_record.colorize_logging = true</diff>
      <filename>config/environments/development.rb</filename>
    </modified>
    <modified>
      <diff>@@ -5,6 +5,7 @@ ActionController::Routing::Routes.draw do |map|
   map.resources :connections
   map.resources :password_reminders
   map.resources :photos
+  map.open_id_complete 'session', :controller =&gt; &quot;sessions&quot;, :action =&gt; &quot;create&quot;, :requirements =&gt; { :method =&gt; :get }
   map.resource :session
   map.resources :messages, :collection =&gt; { :sent =&gt; :get, :trash =&gt; :get },
                            :member =&gt; { :reply =&gt; :get, :undestroy =&gt; :put }</diff>
      <filename>config/routes.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>b3545446b9068f63271ff04c8017387091d3b88b</id>
    </parent>
  </parents>
  <author>
    <name>Tom Brown</name>
    <email>herestomwiththeweather@gmail.com</email>
  </author>
  <url>http://github.com/herestomwiththeweather/insoshi/commit/cbed5958cb6cf67b05e73b32b8ed52a88b62762d</url>
  <id>cbed5958cb6cf67b05e73b32b8ed52a88b62762d</id>
  <committed-date>2008-09-05T03:40:04-07:00</committed-date>
  <authored-date>2008-09-05T03:40:04-07:00</authored-date>
  <message>first pass at openid implementation</message>
  <tree>152fa14162913de22218a4ee71ef6f9cd37a285f</tree>
  <committer>
    <name>Tom Brown</name>
    <email>herestomwiththeweather@gmail.com</email>
  </committer>
</commit>
