X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fpleroma%2Fcaptcha%2Fnative.ex;h=2c6f64e66b24789262b16590f7d05ad076941b17;hb=793fc77b160ae2bcaded23d22d7606c2ab499f0a;hp=06c479ca9606fe2530bb0ca986bfcf0ec8e85ab9;hpb=6da65400362d2189a995a182789c099b108b26bc;p=akkoma
diff --git a/lib/pleroma/captcha/native.ex b/lib/pleroma/captcha/native.ex
index 06c479ca9..2c6f64e66 100644
--- a/lib/pleroma/captcha/native.ex
+++ b/lib/pleroma/captcha/native.ex
@@ -1,9 +1,8 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors
+# Copyright © 2017-2021 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Captcha.Native do
- import Pleroma.Web.Gettext
alias Pleroma.Captcha.Service
@behaviour Service
@@ -11,21 +10,22 @@ defmodule Pleroma.Captcha.Native do
def new do
case Captcha.get() do
:error ->
- %{error: dgettext("errors", "Captcha 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