Route::match(['get'], $segment . '/create-from-website', $controller . '@createFromWebsite')->withoutMiddleware([VerifyCsrfToken::class, Authenticate::class, CheckIfAdmin::class]);
}
+ protected static function checkSpam($post)
+ {
+ if (strlen($post['fax']) > 0) {
+ return true;
+ }
+ $prenom = trim(mb_strtolower(str_replace(' ', '', $post['prenom'])));
+ $nom = trim(mb_strtolower(str_replace(' ', '', $post['nom'])));
+ if ($prenom == $nom) {
+ return true;
+ }
+ if (strlen($prenom) >= 4 && str_starts_with($nom, $prenom)) {
+ return true;
+ }
+ return false;
+ }
+
protected function createFromWebsite()
{
$post = $this->validateCreateRequest();
if ($post === false) {
$resp['message'] = sprintf(__("Une erreur s'est produite. Nous avons été averti de l'erreur que vous rencontrez. Vous pouvez nous contacter par e-mail à l'adresse suivante : %s", [], $post['lang']), '<a href="mailto:info@fluidbook.com">info@fluidbook.com</a>');
} else {
- $spam = (strlen($post['fax']) > 0) || ($post['prenom'] === $post['nom']);
+ $spam = self::checkSpam($post);
$post['spam'] = $spam ? 'Oui' : 'Non';
if (!$spam) {