Permalink
Browse files

Moving to Joe's computer 3.

  • Loading branch information...
Mike Simpson
Mike Simpson committed Dec 21, 2012
1 parent daf2ea4 commit fedcbf5448bc448bf58b79332988929dbd1b50d0
Showing with 14 additions and 0 deletions.
  1. +14 −0 app/controllers/users/omniauth_callbacks_controller.rb
@@ -0,0 +1,14 @@
+class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
+ def github
+ # You need to implement the method below in your model (e.g. app/models/user.rb)
+ @user = User.find_for_github_oauth(request.env["omniauth.auth"], current_user)
+
+ if @user.persisted?
+ sign_in_and_redirect @user, :event => :authentication #this will throw if @user is not activated
+ set_flash_message(:notice, :success, :kind => "github") if is_navigational_format?
+ else
+ session["devise.github_data"] = request.env["omniauth.auth"]
+ redirect_to new_user_registration_url
+ end
+ end
+end

0 comments on commit fedcbf5

Please sign in to comment.