Skip to content

Instantly share code, notes, and snippets.

@mokevnin
Created February 6, 2012 19:10
Show Gist options
  • Select an option

  • Save mokevnin/1754138 to your computer and use it in GitHub Desktop.

Select an option

Save mokevnin/1754138 to your computer and use it in GitHub Desktop.
class Web::User::FacebookController < Web::User::ApplicationController
def register
fb_hash = FacebookIntegration.get_auth_hash(
register_user_facebook_url, params['code'])
user = FacebookService.register(fb_hash)
sign_in(user)
redirect_to :root, :notice => t('web.messages.user.facebook.logged_in')
rescue UserBlockedError
redirect_to :root, :error => t('web.messages.users.blocked')
rescue ConfirmationRequiredError => error
request_provider_confirmation(error.user,
configus.social.facebook.provider_name, auth_hash)
redirect_to new_provider_confirmation_path,
:notice => t('web.messages.user.facebook.confirm_connection')
rescue ServiceError
redirect_to :root, :error => t('web.messages.user.facebook.login_failed')
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment