aamirkh521 / yii-user

Automatically exported from code.google.com/p/yii-user
0 stars 0 forks source link

Regex validation for UserRecoveryForm #94

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Model User allows underscore in user name.

The relevant validation rule from User model:

array('username', 'match', 'pattern' => '/^[A-Za-z0-9_]+$/u','message' => 
UserModule::t("Incorrect symbols (A-z0-9).")),

If a user tries to recover (reset) their password however, the UserRecoveryForm 
model doesn't allow the login_or_email field to contain an underscore:

array('login_or_email', 'match', 'pattern' => 
'/^[A-Za-z0-9@.-\s,]+$/u','message' => UserModule::t("Incorrect symbols 
(A-z0-9).")),

I changed the code in my instance to:

array('login_or_email', 'match', 'pattern' => 
'/^[A-Za-z0-9_@.-\s,]+$/u','message' => UserModule::t("Incorrect symbols 
(A-z0-9).")),

Original issue reported on code.google.com by markadas...@gmail.com on 1 Jul 2011 at 5:53