Sha256: bdb588eb14588797be112bbbaceac31154d56bfa2da23edad9e6b4c0b840201e

Contents?: true

Size: 699 Bytes

Versions: 3

Compression:

Stored size: 699 Bytes

Contents

module Nyauth
  class PasswordsController < ApplicationController
    include Nyauth::ApplicationConcern
    include Nyauth::ClientConcern
    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

3 entries across 3 versions & 1 rubygems

Version Path
nyauth-0.2.4 app/controllers/nyauth/passwords_controller.rb
nyauth-0.2.3 app/controllers/nyauth/passwords_controller.rb
nyauth-0.2.2 app/controllers/nyauth/passwords_controller.rb