Skip to content

Instantly share code, notes, and snippets.

@agibralter
Created April 9, 2010 02:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save agibralter/360833 to your computer and use it in GitHub Desktop.
Save agibralter/360833 to your computer and use it in GitHub Desktop.
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.
}
});
});
};
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