Merge branch 'feature/captcha-expose-timeout' into 'develop'
Expose seconds_valid in Pleroma Captcha API endpoint Closes #1954 See merge request pleroma/pleroma!2812
This commit is contained in:
commit
d39b72c8fa
@ -33,6 +33,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||||||
contents has been renamed to `hide_notification_contents`
|
contents has been renamed to `hide_notification_contents`
|
||||||
- Mastodon API: Added `pleroma.metadata.post_formats` to /api/v1/instance
|
- Mastodon API: Added `pleroma.metadata.post_formats` to /api/v1/instance
|
||||||
- Mastodon API (legacy): Allow query parameters for `/api/v1/domain_blocks`, e.g. `/api/v1/domain_blocks?domain=badposters.zone`
|
- Mastodon API (legacy): Allow query parameters for `/api/v1/domain_blocks`, e.g. `/api/v1/domain_blocks?domain=badposters.zone`
|
||||||
|
- Pleroma API: `/api/pleroma/captcha` responses now include `seconds_valid` with an integer value.
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
|
@ -50,7 +50,7 @@ Request parameters can be passed via [query strings](https://en.wikipedia.org/wi
|
|||||||
* Authentication: not required
|
* Authentication: not required
|
||||||
* Params: none
|
* Params: none
|
||||||
* Response: Provider specific JSON, the only guaranteed parameter is `type`
|
* Response: Provider specific JSON, the only guaranteed parameter is `type`
|
||||||
* Example response: `{"type": "kocaptcha", "token": "whatever", "url": "https://captcha.kotobank.ch/endpoint"}`
|
* Example response: `{"type": "kocaptcha", "token": "whatever", "url": "https://captcha.kotobank.ch/endpoint", seconds_valid: 300}`
|
||||||
|
|
||||||
## `/api/pleroma/delete_account`
|
## `/api/pleroma/delete_account`
|
||||||
### Delete an account
|
### Delete an account
|
||||||
|
@ -21,7 +21,8 @@ defmodule Pleroma.Captcha.Kocaptcha do
|
|||||||
type: :kocaptcha,
|
type: :kocaptcha,
|
||||||
token: json_resp["token"],
|
token: json_resp["token"],
|
||||||
url: endpoint <> json_resp["url"],
|
url: endpoint <> json_resp["url"],
|
||||||
answer_data: json_resp["md5"]
|
answer_data: json_resp["md5"],
|
||||||
|
seconds_valid: Pleroma.Config.get([Pleroma.Captcha, :seconds_valid])
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -17,7 +17,8 @@ defmodule Pleroma.Captcha.Native do
|
|||||||
type: :native,
|
type: :native,
|
||||||
token: token(),
|
token: token(),
|
||||||
url: "data:image/png;base64," <> Base.encode64(img_binary),
|
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
|
||||||
end
|
end
|
||||||
|
@ -41,7 +41,8 @@ defmodule Pleroma.CaptchaTest do
|
|||||||
answer_data: answer,
|
answer_data: answer,
|
||||||
token: ^token,
|
token: ^token,
|
||||||
url: ^url,
|
url: ^url,
|
||||||
type: :kocaptcha
|
type: :kocaptcha,
|
||||||
|
seconds_valid: 300
|
||||||
} = new
|
} = new
|
||||||
|
|
||||||
assert Kocaptcha.validate(token, "7oEy8c", answer) == :ok
|
assert Kocaptcha.validate(token, "7oEy8c", answer) == :ok
|
||||||
@ -56,7 +57,8 @@ defmodule Pleroma.CaptchaTest do
|
|||||||
answer_data: answer,
|
answer_data: answer,
|
||||||
token: token,
|
token: token,
|
||||||
type: :native,
|
type: :native,
|
||||||
url: "data:image/png;base64," <> _
|
url: "data:image/png;base64," <> _,
|
||||||
|
seconds_valid: 300
|
||||||
} = new
|
} = new
|
||||||
|
|
||||||
assert is_binary(answer)
|
assert is_binary(answer)
|
||||||
|
@ -16,7 +16,8 @@ defmodule Pleroma.Captcha.Mock do
|
|||||||
type: :mock,
|
type: :mock,
|
||||||
token: "afa1815e14e29355e6c8f6b143a39fa2",
|
token: "afa1815e14e29355e6c8f6b143a39fa2",
|
||||||
answer_data: @solution,
|
answer_data: @solution,
|
||||||
url: "https://example.org/captcha.png"
|
url: "https://example.org/captcha.png",
|
||||||
|
seconds_valid: 300
|
||||||
}
|
}
|
||||||
|
|
||||||
@impl Service
|
@impl Service
|
||||||
|
Loading…
Reference in New Issue
Block a user