gavin1420 / yii-user

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

Inconsistent 'username' validation rules #49

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Register a new user with a username containing spaces, e.g. "John Smith"
2. Login using username containing spaces.
3. Try and update the user profile (won't accept spaces on save).

What is the expected output? What do you see instead?

The registration form allows usernames to be created containing spaces, whereas 
this contravenes the rules allowed when updating the user profiles. I noticed 
this when trying to work out why the 'lastvisit' field did not populate in the 
tbl_users table for users with usernames containing spaces.

What version of the product are you using? On what operating system?

yii-user-0.3-r69

Mac OS X 10.6 (Snow Leopard) running MAMP 1.9.2

Please provide any additional information below.

I noticed there is a difference in the regular expressions used for validation 
of the username fields, i.e.

Registration Form [modules/user/models/RegistrationForm.php]:

'pattern' => '/^[A-Za-z0-9\s,]+$/u'

Update User Form [modules/user/models/User.php]:

'pattern' => '/^[A-Za-z0-9_]+$/u'

NOTE: changing the Registration Form pattern to match the User form corrects 
the inconsistency and ensures usernames cannot contain spaces, which I presume 
is the original intention.

Original issue reported on code.google.com by rob.ande...@gtempaccount.com on 28 Dec 2010 at 9:33

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r83.

Original comment by mish...@gmail.com on 27 Jan 2011 at 3:52