Merge branch 'feature/native-captcha' into 'develop'
Add native captcha and enable it by default. Closes #1017 and #1405 See merge request pleroma/pleroma!2060
This commit is contained in:
commit
2f31cef71f
9 changed files with 69 additions and 4 deletions
|
|
@ -8,6 +8,7 @@ defmodule Pleroma.CaptchaTest do
|
|||
import Tesla.Mock
|
||||
|
||||
alias Pleroma.Captcha.Kocaptcha
|
||||
alias Pleroma.Captcha.Native
|
||||
|
||||
@ets_options [:ordered_set, :private, :named_table, {:read_concurrency, true}]
|
||||
|
||||
|
|
@ -43,4 +44,21 @@ defmodule Pleroma.CaptchaTest do
|
|||
) == :ok
|
||||
end
|
||||
end
|
||||
|
||||
describe "Native" do
|
||||
test "new and validate" do
|
||||
new = Native.new()
|
||||
|
||||
assert %{
|
||||
answer_data: answer,
|
||||
token: token,
|
||||
type: :native,
|
||||
url: "data:image/png;base64," <> _
|
||||
} = new
|
||||
|
||||
assert is_binary(answer)
|
||||
assert :ok = Native.validate(token, answer, answer)
|
||||
assert {:error, "Invalid CAPTCHA"} == Native.validate(token, answer, answer <> "foobar")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue