Permalink
Browse files

Added paranoid mode to lockable

  • Loading branch information...
1 parent 422bc4a commit 40c0a7b50b7728d2e473fe3e33e15a48bf3cbf70 Rodrigo Flores committed Jun 21, 2011
Showing with 11 additions and 4 deletions.
  1. +10 −4 app/controllers/devise/unlocks_controller.rb
  2. +1 −0 config/locales/en.yml
@@ -12,11 +12,17 @@ def new
def create
self.resource = resource_class.send_unlock_instructions(params[resource_name])
- if resource.errors.empty?
- set_flash_message :notice, :send_instructions if is_navigational_format?
- respond_with resource, :location => new_session_path(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 => new_session_path(resource_name)
+ else
+ respond_with_navigational(resource){ render_with_scope :new }
+ end
end
end
View
@@ -40,6 +40,7 @@ en:
unlocks:
send_instructions: 'You will receive an email with instructions about how to unlock your account in a few minutes.'
unlocked: 'Your account was successfully unlocked. You are now signed in.'
+ send_paranoid_instructions: 'If your account exists, you will receive an email with instructions about how to unlock it in a few minutes.'
omniauth_callbacks:
success: 'Successfully authorized from %{kind} account.'
failure: 'Could not authorize you from %{kind} because "%{reason}".'

0 comments on commit 40c0a7b

Please sign in to comment.