Locations and verification
Validate Build / validate-build (push) Failing after 35s
Validate Build / validate-build (push) Failing after 35s
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/**
|
||||
* @package ogre-captcha
|
||||
* @author cleverogre
|
||||
* @copyright 2026 CleverOgre
|
||||
* @license GLP-3.0-or-later
|
||||
* @version 0.0.0
|
||||
* @since 0.0.0
|
||||
*/
|
||||
|
||||
namespace Ogre\Captcha\Location;
|
||||
|
||||
use Override;
|
||||
use Ogre\Captcha\Location;
|
||||
use Ogre\Captcha\Settings;
|
||||
use WP_Error;
|
||||
use WP_Post;
|
||||
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
final class PostPasswordForm extends Location {
|
||||
|
||||
protected function __construct() {
|
||||
parent::__construct(Settings::LOCATION_POST_PASSWORD_FORM);
|
||||
}
|
||||
|
||||
#[Override]
|
||||
public function activate(): void
|
||||
{
|
||||
add_filter('the_password_form', [$this, 'render_form']);
|
||||
add_action('login_form_postpass', [$this, 'process_form']);
|
||||
}
|
||||
|
||||
public function render_form(string $output, WP_Post $post, string $invalid_password):string {
|
||||
ob_start();
|
||||
$this->render();
|
||||
$output .= ob_get_clean();
|
||||
return $output;
|
||||
}
|
||||
|
||||
public function process_form():void {
|
||||
$errors = new WP_Error();
|
||||
$this->process($errors);
|
||||
$this->print_errors($errors);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
PostPasswordForm::instance();
|
||||
Reference in New Issue
Block a user