Permalink
Browse files

allow proper creation of new record for auto-register

  • Loading branch information...
1 parent 65c7eff commit 4d0f50763e1edd6c1304b329030124be16e5af88 @cpjolicoeur cpjolicoeur committed with mreinsch Dec 5, 2009
Showing with 6 additions and 2 deletions.
  1. +6 −2 lib/authlogic_openid/session.rb
@@ -94,10 +94,12 @@ def validate_by_openid
self.remember_me = controller.params[:remember_me] == "true" if controller.params.key?(:remember_me)
options = {
+ :required => klass.openid_required_fields,
+ :optional => klass.openid_optional_fields,
:return_to => controller.url_for(:for_session => "1", :remember_me => remember_me?),
:method => :post}
- controller.send(:authenticate_with_open_id, openid_identifier, options) do |result, openid_identifier|
+ controller.send(:authenticate_with_open_id, openid_identifier, options) do |result, openid_identifier, registration|
if result.unsuccessful?
errors.add_to_base(result.message)
return
@@ -107,7 +109,9 @@ def validate_by_openid
if !attempted_record
if auto_register?
- self.attempted_record = klass.new :openid_identifier=>openid_identifier
+ self.attempted_record = klass.new
+ attempted_record.openid_identifier = openid_identifier
+ attempted_record.send(:map_openid_registration, registration)
if ! attempted_record.save
errors.add(:openid_identifier, "error auto-registering new openid account")

0 comments on commit 4d0f507

Please sign in to comment.