Allow more email RFC accepted chars in username

Issue:
Gerrit allows to specify email like username (especially handy
when one wants to maintain unique email addresses across the server).
However as opposite to what is described in [1] it allows only:
._- characters from allowed set that contains !#$%&‘*+–/=?^_`.{|}~

Considering the fact that I was able to perform clone (over SSH
and HTTP) push for review, review and submit with all those
characters but / this patch proposes to extend username allowed
chars to !#$%&‘*+–=?^_`.{|}~ when @ is used (we have email like
username) but keeps original characters set a-zA-Z0-9 when one
uses single character for username.

[1] https://www.mailboxvalidator.com/resources/articles/acceptable-email-address-syntax-rfc/

Change-Id: Iabb82cea5be32a68fe1d9fc65a6ca08743063a3f
Signed-off-by: Jacek Centkowski <jcentkowski@collab.net>
This commit is contained in:
Jacek Centkowski
2018-08-31 15:44:44 +02:00
parent 3f9c740c4a
commit dc118d9a7e
3 changed files with 13 additions and 4 deletions

View File

@@ -41,7 +41,7 @@ class UsernameField extends Composite {
// corresponding regular expressions in the
// com.google.gerrit.server.account.ExternalId class.
private static final String USER_NAME_PATTERN_FIRST_REGEX = "[a-zA-Z0-9]";
private static final String USER_NAME_PATTERN_REST_REGEX = "[a-zA-Z0-9._@-]";
private static final String USER_NAME_PATTERN_REST_REGEX = "[a-zA-Z0-9.!#$%&*+=?^_`\\{|\\}~@-]";
private CopyableLabel userNameLbl;
private NpTextBox userNameTxt;