Skip to content

Instantly share code, notes, and snippets.

@1c7
Created January 16, 2017 05:08
Show Gist options
  • Select an option

  • Save 1c7/bd0c5e9aa941634eb9d4c7382b4e6451 to your computer and use it in GitHub Desktop.

Select an option

Save 1c7/bd0c5e9aa941634eb9d4c7382b4e6451 to your computer and use it in GitHub Desktop.
class OmniauthCallbackController < Devise::OmniauthCallbacksController
def wechat
@user = User.from_omniauth(request.env["omniauth.auth"])
if @user.persisted?
sign_in_and_redirect @user, :event => :authentication
else
session["devise.wechat_data"] = request.env["omniauth.auth"]
redirect_to new_user_registration_url
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment