Im working on a project where I need to implement restrictions/requirements to the passwords that customers enter when they register. I have implemented the following:
I am doing this manually without using any apps/plugins. My issue is that my js scripts only work for the “reset password” page but it doesn’t check the passwords entered when the user registers. Im targeting the password input fields from the main-register.liquid file and main-activate-account.liquid file using the input’s ids. I put the Js code below in the theme.liquid file.
Does anyone know why the password field in the registration form isn’t working like it’s supposed to?
My scripts in theme.liquid:
Hey @Microbry !
I am not sure about doing this with JS, but I know this can be done by editing the HTML of the form directly to add a pattern attribute. Here’s a guide from our company about how to do this on the activate account page, but it should be essentially the same process for the registration page as well: https://heliumdev.com/blog/shopify-strong-passwords-customer-account-activation-page
The one thing is that I know some themes add a ‘novalidate’ tag into the create account form. I know when using our HTML method this needs to be removed, and that could be the same problem being experienced with your JS method.
It sounds like you are on the right track here so you probably don’t need it, but if anyone else is looking for a no-code solution for this problem, this can also be done using the Helium Customer Fields app where you can easily add validation rules directly to any field.
It appears that my issue was with “novalidate” in my main-register.liquid.
Thank you for pointing it out.
Hey @Microbry ,
Its been a while since this discussion. I hope you are doing well.
Since I have the same struggle, It seems like you have solved it. So is there a chance to just throw a few words about how you have done it without an app? We can also take the conversation privately if you don’t want to write it down here.
Thanks in advance! Hope to hear from you soon!
Best,
Choob Shop