From 225c89fbf17ee70afb5c09ab13c048a5e544efac Mon Sep 17 00:00:00 2001 From: Rodrigo Flores Date: Mon, 20 Jun 2011 22:30:25 -0300 Subject: [PATCH] Paranoid mode on confirmable --- app/controllers/devise/confirmations_controller.rb | 14 ++++++++++---- config/locales/en.yml | 1 + 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/controllers/devise/confirmations_controller.rb b/app/controllers/devise/confirmations_controller.rb index 3ee92436b6..3d3b496b04 100644 --- a/app/controllers/devise/confirmations_controller.rb +++ b/app/controllers/devise/confirmations_controller.rb @@ -11,11 +11,17 @@ def new def create self.resource = resource_class.send_confirmation_instructions(params[resource_name]) - if resource.errors.empty? - set_flash_message(:notice, :send_instructions) if is_navigational_format? - respond_with resource, :location => after_resending_confirmation_instructions_path_for(resource_name) - else + if Devise.paranoid + set_flash_message(:notice, :send_paranoid_instructions) if is_navigational_format? + resource.errors.clear respond_with_navigational(resource){ render_with_scope :new } + else + if resource.errors.empty? + set_flash_message(:notice, :send_instructions) if is_navigational_format? + respond_with resource, :location => after_resending_confirmation_instructions_path_for(resource_name) + else + respond_with_navigational(resource){ render_with_scope :new } + end end end diff --git a/config/locales/en.yml b/config/locales/en.yml index 96ebafb6a7..099a61038f 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -30,6 +30,7 @@ en: send_paranoid_instructions: "If your e-mail exists on our database, you will receive a password recovery link on your e-mail" confirmations: send_instructions: 'You will receive an email with instructions about how to confirm your account in a few minutes.' + send_paranoid_instructions: 'If your e-mail exists on our database, you will receive an email with instructions about how to confirm your account in a few minutes.' confirmed: 'Your account was successfully confirmed. You are now signed in.' registrations: signed_up: 'Welcome! You have signed up successfully.'