Sha256: eb8a47715de08de929dc2678ac41a85cb39ea128a1f396d1bc7020a42f43326a

Contents?: true

Size: 732 Bytes

Versions: 5

Compression:

Stored size: 732 Bytes

Contents

# frozen_string_literal: true

module Masks
  # @visibility private
  class PasswordsController < ApplicationController
    require_mask type: :session, only: :edit
    require_access "actor.password", only: :update

    before_action only: %i[update] do
      require_sudo(password_path)
    end

    def edit
      respond_to { |format| format.html { render(:edit) } }
    end

    def update
      if password_param
        current_access.change_password(password_param)

        flash[:errors] = @actor.errors.full_messages unless @actor.valid?
      end

      respond_to { |format| format.html { redirect_to password_path } }
    end

    private

    def password_param
      params.dig(:password, :change)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
masks-0.4.0 app/controllers/masks/passwords_controller.rb
masks-0.3.2 app/controllers/masks/passwords_controller.rb
masks-0.3.1 app/controllers/masks/passwords_controller.rb
masks-0.3.0 app/controllers/masks/passwords_controller.rb
masks-0.2.0 app/controllers/masks/passwords_controller.rb