Skip to content

Commit

Permalink
when auto-creating records:
Browse files Browse the repository at this point in the history
- display the actual errors to the user
- make sure to not set attempted_record if the record couldn't be saved, otherwise it will be forced-saved by a callback later on
  • Loading branch information
Michael Reinsch committed Mar 19, 2010
1 parent 1134b75 commit da8dc29
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lib/authlogic_openid/session.rb
Expand Up @@ -109,17 +109,17 @@ def validate_by_openid


if !attempted_record if !attempted_record
if auto_register? if auto_register?
self.attempted_record = klass.new auto_reg_record = klass.new
attempted_record.openid_identifier = openid_identifier auto_reg_record.openid_identifier = openid_identifier
attempted_record.send(:map_openid_registration, registration) auto_reg_record.send(:map_openid_registration, registration)


if ! attempted_record.save if !auto_reg_record.save
errors.add(:openid_identifier, "error auto-registering new openid account") auto_reg_record.errors.each {|attr, msg| errors.add(attr, msg) }
else
self.attempted_record = auto_reg_record
end end
return
else else
errors.add(:openid_identifier, "did not match any users in our database, have you set up your account to use OpenID?") errors.add(:openid_identifier, "did not match any users in our database, have you set up your account to use OpenID?")
return
end end
end end
end end
Expand Down

0 comments on commit da8dc29

Please sign in to comment.