Skip to content
This repository
Browse code

Added after_sending_reset_unlock_instructions_path_for which can be o…

…verridden in extensions to modify the redirect path
  • Loading branch information...
commit fafea15fa8094773ca05b1de9b9f375516c77e1e 1 parent 3752981
Mark Kremer mkremer authored

Showing 1 changed file with 10 additions and 2 deletions. Show diff stats Hide diff stats

  1. +10 2 app/controllers/devise/unlocks_controller.rb
12 app/controllers/devise/unlocks_controller.rb
@@ -11,7 +11,7 @@ def create
11 11 self.resource = resource_class.send_unlock_instructions(params[resource_name])
12 12
13 13 if successfully_sent?(resource)
14   - respond_with({}, :location => new_session_path(resource_name))
  14 + respond_with({}, :location => after_sending_reset_unlock_instructions_path_for(resource))
15 15 else
16 16 respond_with(resource)
17 17 end
@@ -23,9 +23,17 @@ def show
23 23
24 24 if resource.errors.empty?
25 25 set_flash_message :notice, :unlocked if is_navigational_format?
26   - respond_with_navigational(resource){ redirect_to new_session_path(resource) }
  26 + respond_with_navigational(resource){ redirect_to after_sending_reset_unlock_instructions_path_for(resource) }
27 27 else
28 28 respond_with_navigational(resource.errors, :status => :unprocessable_entity){ render :new }
29 29 end
30 30 end
  31 +
  32 + protected
  33 +
  34 + # The path used after sending unlock password instructions
  35 + def after_sending_reset_unlock_instructions_path_for(resource)
  36 + new_session_path(resource)
  37 + end
  38 +
31 39 end

0 comments on commit fafea15

Please sign in to comment.
Something went wrong with that request. Please try again.