Created attachment 764860 [details] Screenshot of error Description of problem: Error message for username field reads must match "{regex}" Version-Release number of selected component (if applicable): Dev How reproducible: Easily, always Steps to Reproduce: 1. Go to http://localhost:9898/zanata/account/register 2. Enter d2|e into the field 3. Shift focus to another field (e.g. press Tab) Actual results: Error message shows must match "{regex}" Expected results: A descriptive error, e.g. may only contain numbers and lowercase letters Additional info: -
Fix in 3.0.0-alpha-2-SNAPSHOT (20130625-1217) See: https://github.com/zanata/zanata-server/commit/aba980218fca919149fc91ad91b0a6dd6cc1b52d
I think it's still a good idea to have the quotes around the regex. Also, Damian suggested a more descriptive message. How about this? javax.validation.constraints.Pattern.message=lowercase letters and digits (regex "{regexp}")
javax.validation.constraints.Pattern.message is a generic key used for annotation @Pattern(regexp=). Propose to have new annotation for username validation if specific message needed for this case.
Ignore the proposed solution above, overriding default message key for username validation.
Implemented new message for username validation: lowercase letters and digits (regex "{regexp}") See https://github.com/zanata/zanata-server/commit/6d8c4a5792fc6f2b14e3354f3fce59d2db617b26
I'm not sure we really need to show a user the regex at all, and we don't tell them explicitly they can use underscores, but I'll consider this fixed.
Testing with Zanata version 3.0.0-alpha-2-SNAPSHOT (20130809-1233) In Edit profile View: Invalid username still returns : must match ^[a-z\d_]{3,20}$ Step to reproduce: 1. Sign up use Google 2. Obtain authentication from Google. 3. In Edit Profile View, type "Aa" Expected: Error message: Allowed: lowercase letters, digits and underscores (regex "^[a-z\d_]{3,20}$") Actual: must match ^[a-z\d_]{3,20}$ ========================= Also, in Sign Up View, Since underscores are allowed, we should alos state that in error messages: Step to reproduce: 1. Go to sign up form by clicking "Sign Up" 2. In field username, enter "Aa" Expected: Error message: Allowed: lowercase letters, digits and underscores (regex "^[a-z\d_]{3,20}$") Actual: Error message: lowercase letters and digits (regex "^[a-z\d_]{3,20}$") Reassigned.
VERIFIED with Zanata version 3.0.3-SNAPSHOT (20130819-0034)
Closing bugs which were VERIFIED with snapshots <= 3.1.