Created
April 9, 2010 02:44
-
-
Save agibralter/360833 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var connect: function () { | |
FB.Connect.showPermissionDialog("email", function () { | |
$.ajax({ | |
url: '/user_session', | |
type: 'POST', | |
dataType: 'json', | |
data: {facebook_connecting: 1}, | |
success: function (data) { | |
// reload page... etc. | |
} | |
}); | |
}); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UserSession < Authlogic::Session::Base | |
# ... | |
facebook_auth_if :facebook_connecting | |
private | |
# Override AuthlogicFacebookConnect::Session#authenticating_with...? because | |
# it hijacks the login from other methods (email/pass and Twitter). We need | |
# to check if the param :facebook_connecting is being passed as well, which | |
# can be found in facebook.js. | |
def facebook_connecting | |
controller.params[:facebook_connecting].present? | |
end | |
# ... | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment