Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F21907347
captcha_service.ex
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
captcha_service.ex
View Options
# 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:
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
()
::
%{
type
:
atom
(),
token
:
String
.
t
(),
answer_data
:
any
()
}
@doc
"""
Validated the provided captcha solution.
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
"""
@callback
validate
(
token
::
String
.
t
(),
captcha
::
String
.
t
(),
answer_data
::
any
()
)
::
:ok
|
{
:error
,
String
.
t
()}
end
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 28, 1:41 AM (11 h, 20 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
724369
Default Alt Text
captcha_service.ex (1 KB)
Attached To
Mode
rPUBE pleroma-upstream
Attached
Detach File
Event Timeline
Log In to Comment