Browse files

Only skip confirmation if Confirmable is loaded

  • Loading branch information...
1 parent eb3737a commit e02f43c26dc3fe89d7e59271bc74552d3d43543e Pairing Workstation Bender committed Jan 21, 2010
Showing with 9 additions and 5 deletions.
  1. +9 −5 app/controllers/facebook_connects_controller.rb
View
14 app/controllers/facebook_connects_controller.rb
@@ -19,12 +19,16 @@ def new
def create
if params[:session][/\"uid\":(\d+)/]
- params[resource_name] = {:facebook_uid => $1, :email => '', :encrypted_password => 'fb', :password_salt => 'fb' }
+ params[resource_name] = { :facebook_uid => $1,
+ :email => '',
+ :encrypted_password => 'fb',
+ :password_salt => 'fb' }
end
- resource = build_resource
- resource.save(false)
- resource.confirmed_at = Time.now
- resource.confirmation_token = nil
+
+ if build_resource.class.ancestors.include?(Devise::Models::Confirmable)
+ resource.skip_confirmation!
+ end
+
resource.save(false)
sign_in_and_redirect(resource)

0 comments on commit e02f43c

Please sign in to comment.