我正在寻找一种方法,在Prestashop 1.5.6.2上对客户登记表提出一些要求,这样密码至少应该有六个字符长,并且至少包含一个大写字母。
至少有六个字符的第一件事已经完成,但需要配置密码中至少一个大写字母的要求。有人知道怎么做吗?
老客户应该仍然可以使用他们的旧密码登录。
谢谢。
您需要重写Validate::isPasswd()方法。仅此而已。
用于智能验证文件路径/project_folder/themes/theme_name/templates/_partials/form-fields.tpl
<input
class="form-control js-child-focus js-visible-password"
name="{$field.name}"
type="password"
value=""
pattern="{literal}(?=.*'d)(?=.*[a-z])(?=.*[A-Z])(?=.*[$%^&@#]).{8,}{/literal}"
oninvalid="setCustomValidity('Must contain at least one number and one uppercase and lowercase letter, one special symbol($%^&@#) and at least 8 or more characters.')"
oninput="setCustomValidity('')"
{if $field.required}required{/if}
>
对于后端验证,请重写Validate::isPasswd()或定义新方法来验证模式