Sha256: 6514f206460ab7e7ba60db3b1d178f0b7e8674553785a3d9081fe1c2997e02f9

Contents?: true

Size: 916 Bytes

Versions: 13

Compression:

Stored size: 916 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

    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

13 entries across 13 versions & 1 rubygems

Version Path
locomotivecms-4.1.1 app/controllers/locomotive/passwords_controller.rb
locomotivecms-4.1.0 app/controllers/locomotive/passwords_controller.rb
locomotivecms-4.1.0.rc1 app/controllers/locomotive/passwords_controller.rb
locomotivecms-4.0.3 app/controllers/locomotive/passwords_controller.rb
locomotivecms-4.0.2 app/controllers/locomotive/passwords_controller.rb
locomotivecms-4.0.1 app/controllers/locomotive/passwords_controller.rb
locomotivecms-4.0.0 app/controllers/locomotive/passwords_controller.rb
locomotivecms-4.0.0.rc0 app/controllers/locomotive/passwords_controller.rb
locomotivecms-4.0.0.alpha3 app/controllers/locomotive/passwords_controller.rb
locomotivecms-3.4.1 app/controllers/locomotive/passwords_controller.rb
locomotivecms-4.0.0.alpha2 app/controllers/locomotive/passwords_controller.rb
locomotivecms-4.0.0.alpha1 app/controllers/locomotive/passwords_controller.rb
locomotivecms-3.4.0 app/controllers/locomotive/passwords_controller.rb