From 6e9c21781c84a4ccbd78b2137807440c101b0eb5 Mon Sep 17 00:00:00 2001 From: saurabhbhatia Date: Fri, 29 Nov 2013 18:46:07 +0800 Subject: [PATCH] Confirmations Workflow working --- app/controllers/application_controller.rb | 8 -------- app/controllers/basic_infos_controller.rb | 4 ++-- app/controllers/confirmations_controller.rb | 19 ++++++++++++++++--- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 0081723d..65b80c80 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -452,14 +452,6 @@ class ApplicationController < ActionController::Base objects end - def after_sign_in_path_for(resource) - if current_user.email.blank? - admin_users_new_interface_edit_user_data_path(current_user) - else - root_path - end - end - private def mobile_device? diff --git a/app/controllers/basic_infos_controller.rb b/app/controllers/basic_infos_controller.rb index bda825e9..e9e04787 100644 --- a/app/controllers/basic_infos_controller.rb +++ b/app/controllers/basic_infos_controller.rb @@ -1,10 +1,10 @@ class BasicInfosController < ApplicationController layout "devise" def index - if current_user.nil? + if params[:user_id].nil? redirect_to "/users/sign_up" end - @user = current_user + @user = User.find(params[:user_id]) end def form_page diff --git a/app/controllers/confirmations_controller.rb b/app/controllers/confirmations_controller.rb index 48f914ad..6ec06db0 100644 --- a/app/controllers/confirmations_controller.rb +++ b/app/controllers/confirmations_controller.rb @@ -1,9 +1,22 @@ class ConfirmationsController < Devise::ConfirmationsController layout "devise" - private - def after_confirmation_path_for(resource_name, resource) - basic_infos_path +def show + self.resource = resource_class.confirm_by_token(params[:confirmation_token]) + + if resource.errors.empty? + set_flash_message(:notice, :confirmed) if is_navigational_format? + respond_with_navigational(resource){ redirect_to after_confirmation_path_for(resource_name, resource) } + else + respond_with_navigational(resource.errors, :status => :unprocessable_entity){ render_with_scope :new } end +end + +protected + +def after_confirmation_path_for(resource_name, resource) + basic_infos_path(:user_id =>resource.id.to_s) +end + end \ No newline at end of file