logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git

mock.ex (771B)


  1. # Pleroma: A lightweight social networking server
  2. # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
  3. # SPDX-License-Identifier: AGPL-3.0-only
  4. defmodule Pleroma.Captcha.Mock do
  5. alias Pleroma.Captcha.Service
  6. @behaviour Service
  7. @solution "63615261b77f5354fb8c4e4986477555"
  8. def solution, do: @solution
  9. @impl Service
  10. def new,
  11. do: %{
  12. type: :mock,
  13. token: "afa1815e14e29355e6c8f6b143a39fa2",
  14. answer_data: @solution,
  15. url: "https://example.org/captcha.png",
  16. seconds_valid: 300
  17. }
  18. @impl Service
  19. def validate(_token, captcha, captcha) when not is_nil(captcha), do: :ok
  20. def validate(_token, captcha, answer),
  21. do: {:error, "Invalid CAPTCHA captcha: #{inspect(captcha)} ; answer: #{inspect(answer)}"}
  22. end