projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Documentation: Add warning about database mix tasks.
[akkoma]
/
lib
/
pleroma
/
captcha
/
kocaptcha.ex
diff --git
a/lib/pleroma/captcha/kocaptcha.ex
b/lib/pleroma/captcha/kocaptcha.ex
index cd0eb6f2141d0360c69f710ad7a5ed9bd2649d27..4e1a07c596bcee16e4bf405aed785f178a2791de 100644
(file)
--- a/
lib/pleroma/captcha/kocaptcha.ex
+++ b/
lib/pleroma/captcha/kocaptcha.ex
@@
-1,17
+1,22
@@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
defmodule Pleroma.Captcha.Kocaptcha do
defmodule Pleroma.Captcha.Kocaptcha do
+ import Pleroma.Web.Gettext
alias Pleroma.Captcha.Service
@behaviour Service
@impl Service
alias Pleroma.Captcha.Service
@behaviour Service
@impl Service
- def new
()
do
+ def new do
endpoint = Pleroma.Config.get!([__MODULE__, :endpoint])
case Tesla.get(endpoint <> "/new") do
{:error, _} ->
endpoint = Pleroma.Config.get!([__MODULE__, :endpoint])
case Tesla.get(endpoint <> "/new") do
{:error, _} ->
- %{error:
"Kocaptcha service unavailable"
}
+ %{error:
dgettext("errors", "Kocaptcha service unavailable")
}
{:ok, res} ->
{:ok, res} ->
- json_resp =
Poi
son.decode!(res.body)
+ json_resp =
Ja
son.decode!(res.body)
%{
type: :kocaptcha,
%{
type: :kocaptcha,
@@
-28,6
+33,6
@@
defmodule Pleroma.Captcha.Kocaptcha do
if not is_nil(captcha) and
:crypto.hash(:md5, captcha) |> Base.encode16() == String.upcase(answer_data),
do: :ok,
if not is_nil(captcha) and
:crypto.hash(:md5, captcha) |> Base.encode16() == String.upcase(answer_data),
do: :ok,
- else: {:error,
"Invalid CAPTCHA"
}
+ else: {:error,
dgettext("errors", "Invalid CAPTCHA")
}
end
end
end
end