Sha256: 860038c979d8a39d484b38d741d3cd52216bda293d0e4cd67a1a9562734bc318

Contents?: true

Size: 842 Bytes

Versions: 2

Compression:

Stored size: 842 Bytes

Contents

module Nyauth
  class PasswordsController < ApplicationController
    include Nyauth::ApplicationConcern
    include Nyauth::ClientConcern
    include Nyauth::SessionConcern
    before_action -> { require_authentication! as: client_name }

    self.responder = Nyauth::AppResponder
    respond_to :html, :json
    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(client_name) || main_app.root_path)
    end

    private

    def set_client
      @client = client_class.find(current_authenticated.id)
    end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nyauth-0.2.8 app/controllers/nyauth/passwords_controller.rb
nyauth-0.2.7 app/controllers/nyauth/passwords_controller.rb