Skip to content

Instantly share code, notes, and snippets.

@rnaud
Created April 11, 2011 07:00
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 rnaud/913164 to your computer and use it in GitHub Desktop.
Save rnaud/913164 to your computer and use it in GitHub Desktop.
My Onmiauth callback controller.
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
skip_before_filter :beta
def facebook
@user = User.find_for_facebook_oauth(env["omniauth.auth"], current_user)
if @user
if @user.persisted?
flash[:notice] = I18n.t "devise.omniauth_callbacks.success", :kind => "Facebook"
@user.remember_me!
sign_in_and_redirect @user, :event => :authentication
else
session["devise.facebook_data"] = env["omniauth.auth"]
redirect_to new_user_registration_url
end
else
redirect_to("/beta", :notice => 'You haven\'nt been invited yet.')
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment