- Drop the unused polls.show_results_to_participants column (idempotent migration). - Remove CaptchaInterface::getType(), the unused AjaxView with its layout, the empty cell template folder and a redundant setNew() call. - PollsTable::newPoll() normalises and validates once; the create form used to validate the raw input first, so an e-mail address with surrounding spaces was rejected although it would have been trimmed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
30 lines
815 B
PHP
30 lines
815 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Captcha;
|
|
|
|
use Cake\Http\ServerRequest;
|
|
|
|
/**
|
|
* A captcha protects the public forms (create poll, recover links).
|
|
*
|
|
* Lifecycle: the controller calls challenge() when rendering the form and passes
|
|
* the returned array to the `captcha` element; on submit it calls verify().
|
|
*/
|
|
interface CaptchaInterface
|
|
{
|
|
/**
|
|
* Prepares a challenge and returns the data the view element needs.
|
|
*
|
|
* @param \Cake\Http\ServerRequest $request Current request (session access)
|
|
* @return array<string, mixed> Always contains 'type'
|
|
*/
|
|
public function challenge(ServerRequest $request): array;
|
|
|
|
/**
|
|
* @param \Cake\Http\ServerRequest $request Submitted request
|
|
* @return bool
|
|
*/
|
|
public function verify(ServerRequest $request): bool;
|
|
}
|