class PpaParticipativo::Cidadaos::PasswordsController < Devise::PasswordsController
  prepend_before_action :require_no_authentication
  # # Render the #edit only if coming from a reset password email link
  append_before_action :assert_reset_token_passed, only: :edit
  before_action :set_ppa_atual, only: [ :new, :create, :edit, :update ]

  # GET /resource/password/new
  def new
    super
  end
  # POST /resource/password
  def create
    super
  end
  # GET /resource/password/edit?reset_password_token=abcdef
  def edit
    super
  end

  # PUT /resource/password
  def update
    super
  end

  private

    def set_ppa_atual
      @ppa_atual = Ppa::Ppa.find_by(ppa_participativo_ativo: true)
    end

  protected
    def after_resetting_password_path_for(resource)
      ppa_participativo_participe_path
    end

  # The path used after sending reset password instructions
  # def after_sending_reset_password_instructions_path_for(resource_name)
  #   super
  # end

  # Check if a reset_password_token is provided in the request
  # def assert_reset_token_passed
  #   super
  # end

  # Check if proper Lockable module methods are present & unlock strategy
  # allows to unlock resource on password reset
  # def unlockable?(resource)
  #   super
  # end
  #
  # def translation_scope
  #   super
  # end
end
