All Collections
Customer Fields
How-to Guides
How to require strong passwords using regular expressions
How to require strong passwords using regular expressions

Use a regex template to require your customers to create strong passwords

Kyle Weiskopf avatar
Written by Kyle Weiskopf
Updated over a week ago

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.

๐Ÿ“Œ Please note that if you are using account approval or email verification for your form's account creation, you will not be able to require strong passwords using this guide. These account options rely on your theme's account activation page, which Customer Fields does not have the ability to customize. If you want to require strong passwords for your theme's account activation page, you will need to have a theme developer implement this for you.

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). Use the 'Details' tab in the field options and scroll down to the bottom to find a section for 'Validation'.

Step 3

Click the button for 'Add validation rule'.ย  Select 'Must match regular expression' as the qualifier for the new validation rule.

Step 4

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 5

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 6

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?