Skip to content

Instantly share code, notes, and snippets.

@pelargir
Created June 17, 2014 22:28
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 pelargir/15da6cb1bdf23d1a0cf5 to your computer and use it in GitHub Desktop.
Save pelargir/15da6cb1bdf23d1a0cf5 to your computer and use it in GitHub Desktop.
class OmniauthCallbacksController < ApplicationController
def wordpress_oauth2
self.current_user = User.find_for_wordpress_oauth2(request.env['omniauth.auth'])
if current_user
flash[:notice] = "Logged in successfully"
current_user.record_login request.user_agent
else
flash.now[:error] = "Something went wrong (unable to login)"
end
redirect_back_or_default root_url
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment