Module: ApiBlocks::Doorkeeper::Passwords::Controller

Extended by:
ActiveSupport::Concern
Defined in:
lib/api_blocks/doorkeeper/passwords/controller.rb

Overview

ApiBlocks::Doorkeeper::Passwords::Controller implements an API passwords reset workflow.

Examples:

# app/controllers/api/v1/passwords_controller.rb
class Api::V1::PasswordsController < Api::V1::ApplicationController
  include ApiBlocks::Doorkeeper::Passwords::Controller

  private

  def user_model
    User
  end
end
# config/routes.rb
Rails.application.routes.draw do
  scope module: :api do
    namespace :v1 do
      resources :passwords, only: i[create] do
        get :callback, on: :collection
        put :update, on: :collection
      end
    end
  end
end
# app/models/user.rb
class User < ApplicationRecord
  include ApiBlocks::Doorkeeper::Passwords::User
end
# config/initializers/devise.rb
Devise.setup do |config|
  # Configure the class responsible to send e-mails.
  config.mailer = "DeviseMailer"
end
# app/mailers/devise_mailer.rb

class DeviseMailer < Devise::Mailer
  def reset_password_instructions(
    record, token, application = nil, _opts = {}
  )
    @token = token
    @application = application
  end
end