Hi there,
I'm using the CRED plugin to create a User Form that allows logged in users to change their WordPress password, and I have a couple of questions:
+ I'd like to require the new password that the user enters to meet certain password complexity requirements (i.e., be a minimum length, include symbols, etc.). I know I can validate the submitted form data with PHP via the cred_form_validate hook; is there a hook that I can use on the frontend to validate the data via JavaScript before it's submitted?
+ The plugin allows me to specify the new password field and verification field the user enters through a native field type. I'd also like the user to have to enter their *current* password, like below:
enter current password: _______
enter new password: _______
enter new password again: _______
Is this possible?
Thank you!
Saul
Hi,
Thank you for contacting us and I'd be happy to assist.
+ For the frontend validation of the password strength, through JavaScript, you don't need any built-in filter/hook. You can implement the password strength script library of your choice:
hidden link
+ The "current password" field option is not supported, out-of-the-box, so you'll have to include a generic field for this.
Next, you can use a custom function attached to the "cred_form_validate" hook to see if the entered existing password is correct or not, through the "wp_check_password" function:
https://developer.wordpress.org/reference/functions/wp_check_password/
I hope this helps and please let me know if you need any further assistance with this.
regards,
Waqar
Thanks, Waqar! I'll follow your links and instructions as I move forward.
Saul