X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fpleroma%2Fcaptcha%2Fnative.ex;h=8d604d2b2c00dd5af16759c7e8130bdc791914ce;hb=3966add048fda791e6893540d8304b0e626ab9f4;hp=5306fe1aa13d4e470860b31b704c1a27c41b8972;hpb=7528322f83d5bee92a030e2e626436dab327df9b;p=akkoma
diff --git a/lib/pleroma/captcha/native.ex b/lib/pleroma/captcha/native.ex
index 5306fe1aa..8d604d2b2 100644
--- a/lib/pleroma/captcha/native.ex
+++ b/lib/pleroma/captcha/native.ex
@@ -1,31 +1,31 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2019 Pleroma Authors
+# Copyright © 2017-2020 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Captcha.Native do
- import Pleroma.Web.Gettext
alias Pleroma.Captcha.Service
@behaviour Service
@impl Service
def new do
case Captcha.get() do
- {:timeout} ->
- %{error: dgettext("errors", "Captcha timeout")}
+ :error ->
+ %{error: :captcha_error}
{:ok, answer_data, img_binary} ->
%{
type: :native,
token: token(),
url: "data:image/png;base64," <> Base.encode64(img_binary),
- answer_data: answer_data
+ answer_data: answer_data,
+ seconds_valid: Pleroma.Config.get([Pleroma.Captcha, :seconds_valid])
}
end
end
@impl Service
def validate(_token, captcha, captcha) when not is_nil(captcha), do: :ok
- def validate(_token, _captcha, _answer), do: {:error, dgettext("errors", "Invalid CAPTCHA")}
+ def validate(_token, _captcha, _answer), do: {:error, :invalid}
defp token do
10