message = __("Passwords do not match", 'contact-forms'); } else { $this->message = $message; } } public function isValid($value) { $valid = false; if ($this->otherPasswordFieldName !== '') { // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Form validation runs during form processing which handles nonces if (isset($_POST[$this->otherPasswordFieldName])) { // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.ValidatedSanitizedInput.MissingUnslash -- Password comparison, value cast to string $otherValue = stripslashes((string) $_POST[$this->otherPasswordFieldName]); $valid = $value === $otherValue; } } return $valid; } }