Require stronger passwords with a validation rule
By default, Shopify only requires customers to create a 5 digit password. Using Customer Fields, you can require your customers to create a stronger password. This is possible by using the app's form builder to add a validation rule to a password field.
Follow the steps below to add a validation rule to require stronger passwords:
Find the form you wish to make changes to using the Forms page in the app admin, and click the 'Edit' button to launch the form builder.
On the right pane in the form builder, click on the password field to view the field's options (shown in the left pane).
Use the 'Details' tab in the field options and scroll down to the bottom to find a section for 'Validation'.
Click the button for 'Add validation rule'.
Select 'Must match regular expression' as the qualifier for the new validation rule.
Add a regular expression (aka "regex"). You can technically use any regex you desire, but to save you some time we've included a regex template below:
This particular regex will force customers to supply a password that has at least 8 characters, and must include at least one upper case letter, one lower case letter, and one numeric digit.
Add an error message that you wish to show to customers if they do not provide a password that matches the regex. Of course, you're welcome to type in any error message you desire, but here's an example:
Must be at least 8 characters and include one upper case letter, one lower case letter, and one numeric digit.
After you add the regex and error message to the validation rule for the password field, make sure to save your changes by clicking the 'Save' button in the top right of the form builder. We then suggest testing the form to make sure the password field works the way you desire.
Have questions or need help?
Reach out to our support team via chat or email and we'll be happy to assist 😎