Add new payment and shipping parsers for various integrations
- Implemented Google Pay parser in bongooglepay.js - Added Buckaroo 3 payment parser in buckaroo3.js - Introduced DataTrans CW Mastercard parser in datatranscw.js - Created DataTrans CW Credit Card parser in datatranscw_creditcard.js - Developed DHL Assistant shipping parser in dhlassistant.js - Added Estimated Delivery parser in estimateddelivery.js - Implemented Floapay payment parser in floapay.js - Created FS Pickup at Store shipping parser in fspickupatstore.js - Developed Generic Iframe parser in generic_iframe_parser.js - Added Geodis Officiel shipping parser in geodisofficiel.js - Implemented Glob Kurier module shipping parser in globkuriermodule.js - Created Latvija Post Express Pickup Terminal parser in latvijaspastsexpresspastspostterminalslv.js - Developed LP Shipping parser in lpshipping.js - Added Mijora Venipak parser in mijoravenipak.js - Implemented Apple Pay parser in pm_applepay.js - Created Przelewy24 payment parser in przelewy24.js - Developed Pshugls shipping parser in pshugls.js - Added Redsys Insite payment parser in redsysinsite.js - Implemented Tpay payment parser in tpay.js - Updated third-party integration documentation for FedEx DotCom
This commit is contained in:
@@ -23,8 +23,14 @@
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
use PrestaShop\PrestaShop\Core\Crypto\Hashing as Crypto;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
use PrestaShop\PrestaShop\Core\Security\PasswordPolicyConfiguration;
|
||||
use ZxcvbnPhp\Zxcvbn;
|
||||
|
||||
class CheckoutCustomerForm extends AbstractForm
|
||||
{
|
||||
@@ -127,6 +133,59 @@ class CheckoutCustomerForm extends AbstractForm
|
||||
}
|
||||
}
|
||||
|
||||
// New PS 8 Password strength validation
|
||||
$passwordField = $this->getField('password');
|
||||
$guestAllowedCheckout = Configuration::get('PS_GUEST_CHECKOUT_ENABLED');
|
||||
$passwordRequired = is_string($passwordField->getValue()) &&
|
||||
(!empty($passwordField->getValue()) || !$guestAllowedCheckout);
|
||||
if (method_exists('Validate', 'isAcceptablePasswordLength') &&
|
||||
method_exists('Validate', 'isAcceptablePasswordScore') &&
|
||||
$passwordRequired) {
|
||||
if (Validate::isAcceptablePasswordLength($passwordField->getValue()) === false) {
|
||||
$passwordField->addError($this->translator->trans(
|
||||
'Password must be between %d and %d characters long',
|
||||
[
|
||||
Configuration::get(PasswordPolicyConfiguration::CONFIGURATION_MINIMUM_LENGTH),
|
||||
Configuration::get(PasswordPolicyConfiguration::CONFIGURATION_MAXIMUM_LENGTH),
|
||||
],
|
||||
'Shop.Notifications.Error'
|
||||
));
|
||||
}
|
||||
|
||||
if (Validate::isAcceptablePasswordScore($passwordField->getValue()) === false) {
|
||||
$wordingsForScore = [
|
||||
$this->translator->trans('Very weak', [], 'Shop.Theme.Global'),
|
||||
$this->translator->trans('Weak', [], 'Shop.Theme.Global'),
|
||||
$this->translator->trans('Average', [], 'Shop.Theme.Global'),
|
||||
$this->translator->trans('Strong', [], 'Shop.Theme.Global'),
|
||||
$this->translator->trans('Very strong', [], 'Shop.Theme.Global'),
|
||||
];
|
||||
$globalErrorMessage = $this->translator->trans(
|
||||
'The minimum score must be: %s',
|
||||
[
|
||||
$wordingsForScore[(int) Configuration::get(PasswordPolicyConfiguration::CONFIGURATION_MINIMUM_SCORE)],
|
||||
],
|
||||
'Shop.Notifications.Error'
|
||||
);
|
||||
if ($this->context->shop->theme->get('global_settings.new_password_policy_feature') !== true) {
|
||||
$zxcvbn = new Zxcvbn();
|
||||
$result = $zxcvbn->passwordStrength($passwordField->getValue());
|
||||
if (!empty($result['feedback']['warning'])) {
|
||||
$passwordField->addError($this->translator->trans(
|
||||
$result['feedback']['warning'], [], 'Shop.Theme.Global'
|
||||
));
|
||||
} else {
|
||||
$passwordField->addError($globalErrorMessage);
|
||||
}
|
||||
foreach ($result['feedback']['suggestions'] as $suggestion) {
|
||||
$passwordField->addError($this->translator->trans($suggestion, [], 'Shop.Theme.Global'));
|
||||
}
|
||||
} else {
|
||||
$passwordField->addError($globalErrorMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($silentRegistration && Validate::isEmail($emailField->getValue())) {
|
||||
// Allow silent guest registration when email field emits blur() - called from checkEmail routine
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user