Class: AuthHelpers::Controller::Recoverable
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- AuthHelpers::Controller::Recoverable
- Includes:
- Helpers, InheritedResources::BaseHelpers
- Defined in:
- lib/auth_helpers/controller/recoverable.rb
Instance Method Summary collapse
-
#create(options = {}, &block) ⇒ Object
(also: #create!)
POST /account/password POST /account/password.xml.
-
#edit(&block) ⇒ Object
(also: #edit!)
GET /account/password/edit?account=xxxx.
-
#new(&block) ⇒ Object
(also: #new!)
GET /account/password/new.
-
#update(options = {}, &block) ⇒ Object
(also: #update!)
PUT /account/password PUT /account/password.xml.
Methods included from Helpers
Instance Method Details
#create(options = {}, &block) ⇒ Object Also known as: create!
POST /account/password POST /account/password.xml
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/auth_helpers/controller/recoverable.rb', line 22 def create(={}, &block) object = get_or_set_with_send(:find_and_send_reset_password_instructions, params[self.instance_name]) if object.errors.empty? (:notice, 'We sent instruction to reset your password, please check your inbox.') respond_with_dual_blocks(object, , true, block) do |format| format.html { redirect_to([:location] || url_by_name_and_scope(:session)) } end else (:error) respond_with_dual_blocks(object, , false, block) end end |
#edit(&block) ⇒ Object Also known as: edit!
GET /account/password/edit?account=xxxx
38 39 40 41 42 |
# File 'lib/auth_helpers/controller/recoverable.rb', line 38 def edit(&block) object = get_or_set_with_send(:new) object.perishable_token = params[self.instance_name].try(:fetch, :perishable_token) respond_with(object, &block) end |
#new(&block) ⇒ Object Also known as: new!
GET /account/password/new
14 15 16 17 |
# File 'lib/auth_helpers/controller/recoverable.rb', line 14 def new(&block) object = get_or_set_with_send(:new) respond_with(object, &block) end |
#update(options = {}, &block) ⇒ Object Also known as: update!
PUT /account/password PUT /account/password.xml
47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/auth_helpers/controller/recoverable.rb', line 47 def update(={}, &block) object = get_or_set_with_send(:find_and_reset_password, params[self.instance_name]) if object.errors.empty? (:notice, 'Your password was successfully reset.') respond_with_dual_blocks(object, , true, block) do |format| format.html { redirect_to([:location] || url_by_name_and_scope(:session)) } end else (:error) respond_with_dual_blocks(object, , false, block) end end |