Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

changed to work with mongo mapper

  • Loading branch information...
commit cc631fdfd0f2402c99d1991f3abebf1b7ba12761 1 parent 1576c8d
bhbryant authored
3  lib/devise_oauth2_authenticatable/model.rb
View
@@ -196,7 +196,8 @@ def authenticate_with_oauth2(oauth2_id, oauth2_token)
#
def find_for_oauth2(uid, conditions = {})
- self.send(:"find_by_#{self.oauth2_uid_field}", uid.to_i, :conditions => conditions)
+ self.first oauth2_uid_field => uid.to_i
+ # :conditions => conditions)
#self.find_by_oauth2_uid(uid, :conditions => conditions)
end
44 lib/devise_oauth2_authenticatable/sessions_controller_extension.rb
View
@@ -0,0 +1,44 @@
+module Devise #:nodoc:
+ module Oauth2Authenticatable #:nodoc:
+ module SessionsControllerExtension
+ def self.included?(klass)
+ end
+
+
+
+ #prepend_before_filter :require_no_authentication, :only => [ :new, :create, :oauth_callback ]
+ def oauth_callback
+
+ puts "HERE"
+ @errors = params[:error] if params.has_key?(:error)
+ if resource = authenticate(resource_name)
+ set_flash_message :notice, :signed_in
+
+ else
+ set_flash_message :notice, (@errors && @errors[:message]) || "failure"
+ end
+ render "oauth_callback", :layout => false
+ end
+
+
+ # GET /resource/sign_out
+ def destroy
+ set_flash_message :notice, :signed_out if signed_in?(resource_name)
+
+ puts "HERE"
+ if request.xhr?
+ sign_out(resource_name)
+ render "oauth_logout", :layout => false
+ else
+ sign_out(resource_name)
+ #_and_redirect(resource_name)
+ render "oauth_logout", :layout => false
+ end
+
+ end
+
+
+ end
+ end
+end
+
Please sign in to comment.
Something went wrong with that request. Please try again.