Bug 977595 - Register username field has bad regex error message
Summary: Register username field has bad regex error message
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Zanata
Classification: Retired
Component: Component-UI
Version: 3.0
Hardware: All
OS: All
unspecified
low
Target Milestone: ---
: ---
Assignee: Alex Eng
QA Contact: Ding-Yi Chen
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-06-25 01:25 UTC by Damian Jansen
Modified: 2013-11-27 03:22 UTC (History)
3 users (show)

Fixed In Version: 3.0.3-SNAPSHOT (20130819-0034)
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-11-27 03:22:40 UTC
Embargoed:


Attachments (Terms of Use)
Screenshot of error (337 bytes, image/png)
2013-06-25 01:25 UTC, Damian Jansen
no flags Details

Description Damian Jansen 2013-06-25 01:25:23 UTC
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:
-

Comment 1 Alex Eng 2013-06-25 05:14:43 UTC
Fix in 3.0.0-alpha-2-SNAPSHOT (20130625-1217)

See: 
https://github.com/zanata/zanata-server/commit/aba980218fca919149fc91ad91b0a6dd6cc1b52d

Comment 2 Sean Flanigan 2013-06-25 07:23:17 UTC
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}")

Comment 3 Alex Eng 2013-06-25 22:59:13 UTC
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.

Comment 4 Alex Eng 2013-06-25 23:04:07 UTC
Ignore the proposed solution above, overriding default message key for username validation.

Comment 5 Alex Eng 2013-06-25 23:12:48 UTC
Implemented new message for username validation:
lowercase letters and digits (regex "{regexp}") 

See
https://github.com/zanata/zanata-server/commit/6d8c4a5792fc6f2b14e3354f3fce59d2db617b26

Comment 6 Damian Jansen 2013-07-03 23:41:16 UTC
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.

Comment 7 Ding-Yi Chen 2013-08-09 02:55:49 UTC
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.

Comment 8 Ding-Yi Chen 2013-08-19 01:28:53 UTC
VERIFIED with Zanata version 3.0.3-SNAPSHOT (20130819-0034)

Comment 9 Sean Flanigan 2013-11-27 03:22:40 UTC
Closing bugs which were VERIFIED with snapshots <= 3.1.


Note You need to log in before you can comment on or make changes to this bug.