blob: 6476f87b7fe0b3b0f3a2710756eeec42d6ded0a5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
<?php
namespace Studip\Forms;
use CaptchaChallenge;
use URLHelper;
/**
* The Text class represents a part of a form that displays a captcha.
*/
final class CaptchaInput extends Input
{
public function hasValidation(): bool
{
return true;
}
public function getValidationCallback(): callable
{
return fn($value) => \CaptchaChallenge::validatePayload($value);
}
public function render(): string
{
return sprintf(
'<captcha-input challenge-url="%s" v-model="%s" auto="onload"></captcha-input>',
URLHelper::getLink('dispatch.php/captcha/challenge', [], true),
htmlReady($this->name)
);
}
public function renderWithCondition(): string
{
return $this->render();
}
}
|