projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
OAuthPlug, Router: Handle deactivated users in the UserEnabledPlug
[akkoma]
/
lib
/
pleroma
/
captcha
/
captcha_service.ex
diff --git
a/lib/pleroma/captcha/captcha_service.ex
b/lib/pleroma/captcha/captcha_service.ex
index 907a73ad06477bdda81f40a2a3442f67b9ade15e..8d27c04f1e5a5a621c91d7ac8be3ae3b560dc972 100644
(file)
--- a/
lib/pleroma/captcha/captcha_service.ex
+++ b/
lib/pleroma/captcha/captcha_service.ex
@@
-1,12
+1,21
@@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
defmodule Pleroma.Captcha.Service do
@doc """
Request new captcha from a captcha service.
Returns:
defmodule Pleroma.Captcha.Service do
@doc """
Request new captcha from a captcha service.
Returns:
- Service-specific data for using the newly created captcha
+ Type/Name of the service, the token to identify the captcha,
+ the data of the answer and service-specific data to use the newly created captcha
"""
"""
- @callback new() :: map
+ @callback new() :: %{
+ type: atom(),
+ token: String.t(),
+ answer_data: any()
+ }
@doc """
Validated the provided captcha solution.
@doc """
Validated the provided captcha solution.
@@
-14,10
+23,15
@@
defmodule Pleroma.Captcha.Service do
Arguments:
* `token` the captcha is associated with
* `captcha` solution of the captcha to validate
Arguments:
* `token` the captcha is associated with
* `captcha` solution of the captcha to validate
+ * `answer_data` is the data needed to validate the answer (presumably encrypted)
Returns:
`true` if captcha is valid, `false` if not
"""
Returns:
`true` if captcha is valid, `false` if not
"""
- @callback validate(token :: String.t(), captcha :: String.t()) :: boolean
+ @callback validate(
+ token :: String.t(),
+ captcha :: String.t(),
+ answer_data :: any()
+ ) :: :ok | {:error, String.t()}
end
end