Password: changing preg_match in PHP Sign up
Posted: Tue Jun 06, 2017 6:31 am
Hi.
I would wish your advice about two issues.
A. Changing the number of characters that inserted in the password
1.
I would like to change the number of characters that a user must insert in the sign up form.
The PHP code in the Sign up form is the following: ^[A-Za-z0-9_!@$]{1,50}$
I suppose, I can change the range {1,50} to, for example, {6,14}
Tell to me please: Is it correct?
2.
If your answer to question 1 is "YES",
I must change the range on the PHP code:
a. in the HTML object, or
b. In the Password > Editbox > Validate > Data length?
B. Changing the whole preg_match for the password
I see that the default preg_match for the password ^[A-Za-z0-9_!@$]{1,50}$ accepts only these special characters:_!@$
May I change the preg_match from this ^ A-Za-z0-9_!@$]{1,50}$ to this ^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[$@$!%*?&])[A-Za-z\d$@$!%*?&]{8,20} ?
Which means:
At least 1 uppercase letter
At least 1 lowercase letter
At least 1 number
At least 1 special character
May be the last preg_match is too difficult for the user or very wordy?
What is your advice?
Thank you.
Aris
I would wish your advice about two issues.
A. Changing the number of characters that inserted in the password
1.
I would like to change the number of characters that a user must insert in the sign up form.
The PHP code in the Sign up form is the following: ^[A-Za-z0-9_!@$]{1,50}$
I suppose, I can change the range {1,50} to, for example, {6,14}
Tell to me please: Is it correct?
2.
If your answer to question 1 is "YES",
I must change the range on the PHP code:
a. in the HTML object, or
b. In the Password > Editbox > Validate > Data length?
B. Changing the whole preg_match for the password
I see that the default preg_match for the password ^[A-Za-z0-9_!@$]{1,50}$ accepts only these special characters:_!@$
May I change the preg_match from this ^ A-Za-z0-9_!@$]{1,50}$ to this ^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[$@$!%*?&])[A-Za-z\d$@$!%*?&]{8,20} ?
Which means:
At least 1 uppercase letter
At least 1 lowercase letter
At least 1 number
At least 1 special character
May be the last preg_match is too difficult for the user or very wordy?
What is your advice?
Thank you.
Aris