1 defmodule Pleroma.Captcha do
6 GenServer.start_link(__MODULE__, [], name: __MODULE__)
15 Ask the configured captcha service for a new captcha
18 GenServer.call(__MODULE__, :new)
22 Ask the configured captcha service to validate the captcha
24 def validate(token, captcha, answer_data) do
25 GenServer.call(__MODULE__, {:validate, token, captcha, answer_data})
29 def handle_call(:new, _from, state) do
30 enabled = Pleroma.Config.get([__MODULE__, :enabled])
33 {:reply, %{type: :none}, state}
35 {:reply, method().new(), state}
40 def handle_call({:validate, token, captcha, answer_data}, _from, state) do
41 {:reply, method().validate(token, captcha, answer_data), state}
44 defp method, do: Pleroma.Config.get!([__MODULE__, :method])