aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/sessions_controller.rb11
-rw-r--r--config/routes.rb1
2 files changed, 12 insertions, 0 deletions
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb
index 16d11b5..c755c69 100644
--- a/app/controllers/sessions_controller.rb
+++ b/app/controllers/sessions_controller.rb
@@ -1,2 +1,13 @@
class SessionsController < ApplicationController
+ def create
+ @user = User.find_or_create_from_auth_hash(auth_hash)
+ self.current_user = @user
+ redirect_to '/'
+ end
+
+ protected
+
+ def auth_hash
+ request.env['omniauth.auth']
+ end
end
diff --git a/config/routes.rb b/config/routes.rb
index a729a7f..70acae5 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -2,6 +2,7 @@ Rails.application.routes.draw do
root 'home#index'
# get '/auth/evernote' => 'auth/evernote#index'
+ get '/auth/evernote/callback' => 'sessions#create'
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".