Sha256: 560c066fc7aa22e0ef1fbd1c4af84cedc5e30a1aedffa5e3da817cdba87f67d8

Contents?: true

Size: 1.26 KB

Versions: 6

Compression:

Stored size: 1.26 KB

Contents

# frozen_string_literal: true

class Spree::Admin::UserPasswordsController < Devise::PasswordsController
  helper 'spree/base'

  include Spree::Core::ControllerHelpers::Auth
  include Spree::Core::ControllerHelpers::Common
  include Spree::Core::ControllerHelpers::Store

  helper 'spree/admin/navigation'
  layout 'spree/layouts/admin'

  skip_before_action :require_no_authentication, only: [:create]

  # 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.login_path
  #
  def create
    self.resource = resource_class.send_reset_password_instructions(params[resource_name])

    set_flash_message(:notice, :send_instructions) if is_navigational_format?

    if resource.errors.empty?
      respond_with resource, location: admin_user_path(resource)
    else
      respond_with_navigational(resource) { render :new }
    end
  end

  # Devise::PasswordsController allows for blank passwords.
  # Silly Devise::PasswordsController!
  # Fixes spree/spree#2190.
  def update
    if params[:spree_user][:password].blank?
      set_flash_message(:error, :cannot_be_blank)
      render :edit
    else
      super
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
solidus_auth_devise-2.5.4 lib/controllers/backend/spree/admin/user_passwords_controller.rb
solidus_auth_devise-2.5.3 lib/controllers/backend/spree/admin/user_passwords_controller.rb
solidus_auth_devise-2.5.2 lib/controllers/backend/spree/admin/user_passwords_controller.rb
solidus_auth_devise-2.5.1 lib/controllers/backend/spree/admin/user_passwords_controller.rb
solidus_auth_devise-2.5.0 lib/controllers/backend/spree/admin/user_passwords_controller.rb
solidus_auth_devise-2.4.0 lib/controllers/backend/spree/admin/user_passwords_controller.rb