Sha256: a05c8cf7c18b1d1a4319bf13b1d76ef70e75e0c45a1e6876d487c9f317f08fcc

Contents?: true

Size: 944 Bytes

Versions: 2

Compression:

Stored size: 944 Bytes

Contents

module Locomotive
  class PasswordsController < ::Devise::PasswordsController

    include Locomotive::Concerns::SslController
    include Locomotive::Concerns::RedirectToMainHostController
    include Locomotive::Concerns::WithinSiteController

    within_site_only_if_existing true

    layout 'locomotive/layouts/account'

    helper Locomotive::BaseHelper

    respond_to :html, :json

    before_action :set_locale

    def update
      super do |resource|
        if params[:locomotive_account].try(:[], 'password').blank?
          resource.errors.add(:password, :blank)
        end
      end
    end

    private

    def after_sending_reset_password_instructions_path_for(resource_name)
      new_locomotive_account_session_path
    end

    def set_locale
      I18n.locale = current_site? ? current_site.accounts.first.locale : default_locale
    end

    def default_locale
      Locomotive.config.default_locale
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
locomotivecms-4.2.0.alpha2 app/controllers/locomotive/passwords_controller.rb
locomotivecms-4.2.0.alpha1 app/controllers/locomotive/passwords_controller.rb