Sha256: 3a0656588b21272b2c8d15d2826a7ffc3370b40c0f6524e1e597d092fdafb775

Contents?: true

Size: 716 Bytes

Versions: 4

Compression:

Stored size: 716 Bytes

Contents

module Nyauth
  class PasswordsController < Nyauth::BaseController
    before_action -> { require_authentication! as: nyauth_client_name }
    before_action :set_client

    def edit
    end

    def update
      @client.attributes = client_params
      @client.save(context: :update_password)
      respond_with(@client, location: Nyauth.configuration.redirect_path_after_update_password.call(nyauth_client_name) || main_app.root_path)
    end

    private

    def set_client
      @client = nyauth_client_class.find(current_authenticated(as: nyauth_client_name).id)
    end

    def client_params
      params.fetch(nyauth_client_name, {})
            .permit(:password, :password_confirmation)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
nyauth-0.7.2 app/controllers/nyauth/passwords_controller.rb
nyauth-0.7.1 app/controllers/nyauth/passwords_controller.rb
nyauth-0.6.2 app/controllers/nyauth/passwords_controller.rb
nyauth-0.6.1 app/controllers/nyauth/passwords_controller.rb