Sha256: a4d787edef78abf758e868398efc7e43de96fccc0eb248b2bb355dac86ad799b

Contents?: true

Size: 819 Bytes

Versions: 6

Compression:

Stored size: 819 Bytes

Contents

module Nyauth
  class ResetPasswordsController < Nyauth::BaseController
    allow_everyone
    before_action :set_client

    def edit
      unless @client.valid?(:edit_reset_password)
        redirect_to new_session_path_for(nyauth_client_name), alert: @client.errors[:reset_password_key].last
      end
    end

    def update
      @client.reset_password(client_params)
      respond_with(@client, location: Nyauth.configuration.redirect_path_after_reset_password.call(nyauth_client_name) || new_session_path_for(nyauth_client_name))
    end

    private

    def set_client
      @client = nyauth_client_class.find_by!(reset_password_key: params[:reset_password_key])
    end

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
nyauth-0.7.2 app/controllers/nyauth/reset_passwords_controller.rb
nyauth-0.7.1 app/controllers/nyauth/reset_passwords_controller.rb
nyauth-0.7.0 app/controllers/nyauth/reset_passwords_controller.rb
nyauth-0.6.2 app/controllers/nyauth/reset_passwords_controller.rb
nyauth-0.6.1 app/controllers/nyauth/reset_passwords_controller.rb
nyauth-0.6.0 app/controllers/nyauth/reset_passwords_controller.rb