Permalink
Browse files

make record generation for auto-registration more modular to allow cu…

…stom modifications
  • Loading branch information...
1 parent aff4f5e commit 4a1f644be36aec75ae2d35121904b5a846354233 @mreinsch committed Apr 15, 2010
Showing with 8 additions and 4 deletions.
  1. +8 −4 lib/authlogic_openid/session.rb
View
12 lib/authlogic_openid/session.rb
@@ -109,10 +109,7 @@ def validate_by_openid
if !attempted_record
if auto_register?
- auto_reg_record = klass.new
- auto_reg_record.openid_identifier = openid_identifier
- auto_reg_record.send(:map_openid_registration, registration)
-
+ auto_reg_record = create_open_id_auto_register_record(openid_identifier, registration)
if !auto_reg_record.save
auto_reg_record.errors.each {|attr, msg| errors.add(attr, msg) }
else
@@ -124,6 +121,13 @@ def validate_by_openid
end
end
end
+
+ def create_open_id_auto_register_record(openid_identifier, registration)
+ returning klass.new do |auto_reg_record|
+ auto_reg_record.openid_identifier = openid_identifier
+ auto_reg_record.send(:map_openid_registration, registration)
+ end
+ end
def validate_openid_error
errors.add(:openid_identifier, @openid_error) if @openid_error

0 comments on commit 4a1f644

Please sign in to comment.