From 31df114ce4e403e01e0f4b556e8cfdc5a21328e5 Mon Sep 17 00:00:00 2001 From: Stella Date: Sun, 30 Nov 2014 20:06:12 +0200 Subject: [PATCH] sign in user after confirmation --- app/controllers/confirmations_controller.rb | 12 ++++++++++++ config/routes.rb | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 app/controllers/confirmations_controller.rb diff --git a/app/controllers/confirmations_controller.rb b/app/controllers/confirmations_controller.rb new file mode 100644 index 00000000..776665be --- /dev/null +++ b/app/controllers/confirmations_controller.rb @@ -0,0 +1,12 @@ +class ConfirmationsController < Devise::ConfirmationsController + protected + + def after_confirmation_path_for(resource_name, resource) + if signed_in? + signed_in_root_path(resource) + else + sign_in resource + root_path + end + end +end diff --git a/config/routes.rb b/config/routes.rb index 6ee73635..f026f5ba 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -5,7 +5,7 @@ Osem::Application.routes.draw do else devise_for :users, controllers: { - registrations: :registrations, + registrations: :registrations, confirmations: :confirmations, omniauth_callbacks: 'users/omniauth_callbacks' }, path: 'accounts' end