Class: Spree::UserPasswordsController

Inherits:
Devise::PasswordsController
  • Object
show all
Includes:
Core::ControllerHelpers, SslRequirement
Defined in:
app/controllers/spree/user_passwords_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

Overridden due to bug in Devise.

respond_with resource, :location => new_session_path(resource_name)

is generating bad url /session/new.user

overridden to:

respond_with resource, :location => spree.


22
23
24
25
26
27
28
29
30
31
# File 'app/controllers/spree/user_passwords_controller.rb', line 22

def create
  self.resource = resource_class.send_reset_password_instructions(params[resource_name])

  if resource.errors.empty?
    set_flash_message(:notice, :send_instructions) if is_navigational_format?
    respond_with resource, :location => spree.
  else
    respond_with_navigational(resource) { render :new }
  end
end

#updateObject

Devise::PasswordsController allows for blank passwords. Silly Devise::PasswordsController! Fixes spree/spree#2190.



36
37
38
39
40
41
42
43
# File 'app/controllers/spree/user_passwords_controller.rb', line 36

def update
  if params[:user][:password].blank?
    set_flash_message(:error, :cannot_be_blank)
    render :edit
  else
    super
  end
end