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.

Step-by-step instructions

Follow the steps below to add a validation rule to require stronger passwords:

Step 1

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.

Step 2

On the right pane in the form builder, click on the password field to view the field's options (shown in the left pane).

Step 3

Use the 'Details' tab in the field options and scroll down to the bottom to find a section for 'Validation'.

Step 4

Click the button for 'Add validation rule'. 

Step 5

Select 'Must match regular expression' as the qualifier for the new validation rule.

Step 6

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:

^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,20}$ 

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.

Step 7

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.

Step 8

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 😎

Did this answer your question?