LaurentG501 Posted December 3, 2023 Share Posted December 3, 2023 Bonjour, La boutique est privé, les membres reçoivent leur identifiants par mail (=https://grossiste.nc/) Pourtant il y a toutes les semaines plusieurs inscriptions externes ( nom pourris, mais les emails sont ok) ca correspond a du hack Que dois-je faire pour empêcher ca ? Link to comment Share on other sites More sharing options...
Eolia Posted December 3, 2023 Share Posted December 3, 2023 il faut empêcher aussi les appels directs au controlleur ^^ Link to comment Share on other sites More sharing options...
LaurentG501 Posted December 3, 2023 Author Share Posted December 3, 2023 2 hours ago, Eolia said: il faut empêcher aussi les appels directs au controlleur ^^ Ca explique ce que je dois faire ? Perso je n ai rien compris Il y aurait-il une solution simple, genre supprimer le fichier du formulaire pour s'inscrire ? Link to comment Share on other sites More sharing options...
Eolia Posted December 4, 2023 Share Posted December 4, 2023 Remplacez ce bloc dans le fichier /controllers/front/AuthController.php : public function postProcess() { if(Tools::isSubmit('SubmitCreate')) { $this->processSubmitCreate(); } if(Tools::isSubmit('submitAccount') || Tools::isSubmit('submitGuestAccount')) { $this->processSubmitAccount(); } if(Tools::isSubmit('SubmitLogin')) { $this->processSubmitLogin(); } } Par: public function postProcess() { if(Tools::isSubmit('SubmitCreate')) { return false; //$this->processSubmitCreate(); } if(Tools::isSubmit('submitAccount') || Tools::isSubmit('submitGuestAccount')) { return false; //$this->processSubmitAccount(); } if(Tools::isSubmit('SubmitLogin')) { $this->processSubmitLogin(); } } l'ideal serait de faire un override de AuthController. 1 Link to comment Share on other sites More sharing options...
Mediacom87 Posted December 4, 2023 Share Posted December 4, 2023 Bonjour, j'ai un module qui permet de faire cela, disponible sur ma boutique ou sur PrestaShop MarketPlace. 1 Link to comment Share on other sites More sharing options...
endriu107 Posted December 4, 2023 Share Posted December 4, 2023 Si l'inscription porte des noms étranges ou si le nom et le prénom sont identiques, vous pouvez bloquer de telles inscriptions avec ce module gratuit : 1 Link to comment Share on other sites More sharing options...
LaurentG501 Posted December 5, 2023 Author Share Posted December 5, 2023 14 hours ago, Eolia said: public function postProcess() { if(Tools::isSubmit('SubmitCreate')) { return false; //$this->processSubmitCreate(); } if(Tools::isSubmit('submitAccount') || Tools::isSubmit('submitGuestAccount')) { return false; //$this->processSubmitAccount(); } if(Tools::isSubmit('SubmitLogin')) { $this->processSubmitLogin(); } } Impeccable, juste a commenter 2 lignes Un grand Merci Link to comment Share on other sites More sharing options...
LaurentG501 Posted December 5, 2023 Author Share Posted December 5, 2023 public function initContent() { $should_redirect = false; if (Tools::isSubmit('submitCreate') || Tools::isSubmit('create_account')) { $register_form = $this ->makeCustomerForm() ->setGuestAllowed(false) ->fillWith(Tools::getAllValues()); if (Tools::isSubmit('submitCreate')) { $hookResult = array_reduce( Hook::exec('actionSubmitAccountBefore', [], null, true), function ($carry, $item) { return $carry && $item; }, true ); if ($hookResult && $register_form->submit()) { $should_redirect = true; } } $this->context->smarty->assign([ 'register_form' => $register_form->getProxy(), 'hook_create_account_top' => Hook::exec('displayCustomerAccountFormTop'), ]); $this->setTemplate('customer/registration'); } else { $login_form = $this->makeLoginForm()->fillWith( Tools::getAllValues() ); if (Tools::isSubmit('submitLogin')) { if ($login_form->submit()) { $should_redirect = true; } } $this->context->smarty->assign([ 'login_form' => $login_form->getProxy(), ]); $this->setTemplate('customer/authentication'); } Je reviens vers vous car je n ai pas le même code, veuillez me pardonner mon ignorance en la matière La version Prestahop dont je dispose est la 1.7.7.7 Quelle est la ligne ou quelles sont les lignes à mettre en commentaires ? Link to comment Share on other sites More sharing options...
Eolia Posted December 5, 2023 Share Posted December 5, 2023 if (Tools::isSubmit('submitCreate') || Tools::isSubmit('create_account')) { return; $register_form = $this ->makeCustomerForm() ->setGuestAllowed(false) ->fillWith(Tools::getAllValues()); if (Tools::isSubmit('submitCreate')) { $hookResult = array_reduce( Hook::exec('actionSubmitAccountBefore', [], null, true), function ($carry, $item) { return $carry && $item; }, true ); if ($hookResult && $register_form->submit()) { $should_redirect = true; } } $this->context->smarty->assign([ 'register_form' => $register_form->getProxy(), 'hook_create_account_top' => Hook::exec('displayCustomerAccountFormTop'), ]); $this->setTemplate('customer/registration'); Ajoutez uniquement le return; après la ligne if (Tools::isSubmit('submitCreate') || Tools::isSubmit('create_account')) { 1 Link to comment Share on other sites More sharing options...
LaurentG501 Posted December 6, 2023 Author Share Posted December 6, 2023 Simple et Facile Merci infiniment pour votre support !! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now