PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, October 27, 2022

[FIXED] How to remove HTML attribute `pattern` in Prestashop 1.7, *classes/form/CustomerLoginFormatter.php*

 October 27, 2022     formatter, prestashop, prestashop-1.7     No comments   

Issue

My customer connexion form has a password field which contains pattern=".{5,}". Since it's not a registration form, I would want to remove this HTML attribute.

Thus, I opened classes/form/CustomerLoginForm.php and I saw a FormFormatterInterface was used here: classes/form/CustomerLoginFormatter.php.

The latter contains:

public function getFormat()
{
    return [
        [...],
        'password' => (new FormField)
            ->setName('password')
            ->setType('password')
            ->setRequired(true)
            ->setLabel($this->translator->trans(
                'Password', [], 'Shop.Forms.Labels'
            ))
            ->addConstraint('isPasswd'),
    ];
}

No line specify this HTML pattern attribute.

Where could I remove it? Should I write some setter or add some constraint in the above code? (in an override of course)


Solution

You can remove that pattern from the file: /themes/classic/templates/_partials/form-fields.tpl

Search for this line and remove or change as your needs: pattern=".{literal}{{/literal}5,{literal}}{/literal}"



Answered By - Rolige
Answer Checked By - Senaida (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing