Diff comments:
> === modified file 'lib/lp/app/validators/name.py'
> --- lib/lp/app/validators/name.py 2012-11-29 05:52:36 +0000
> +++ lib/lp/app/validators/name.py 2019-05-07 00:19:42 +0000
> @@ -19,6 +19,7 @@
> valid_name_pattern = re.compile(r"^[a-z0-9][a-z0-9\+\.\-]+$")
> valid_bug_name_pattern = re.compile(r"^[a-z][a-z0-9\+\.\-]+$")
> invalid_name_pattern = re.compile(r"^[^a-z0-9]+|[^a-z0-9\\+\\.\\-]+")
> +valid_username_pattern =
> re.compile(r"(?!^[\d-]+$)^[a-z\d](-?[a-z\d]){2,31}$")
Also, it seems a bit weird that the length limit varies depending on how many
hyphens are in the username. "abcdefghijklmnopqrstuvwxyz0123456" fails, but
"abcdefghijklmnopqrstuvwxyz01234-5" succeeds, which doesn't make much sense.
>
>
> def sanitize_name(name):
>
> === modified file 'lib/lp/registry/model/person.py'
> --- lib/lp/registry/model/person.py 2018-11-13 03:48:13 +0000
> +++ lib/lp/registry/model/person.py 2019-05-07 00:19:42 +0000
> @@ -4312,12 +4312,12 @@
> "%s is not a valid email address" % email_addr)
>
> user = re.match("^(\S+)@(?:\S+)$", email_addr).groups()[0]
> - user = user.replace(".", "-").replace("_", "-")
> + user = user.replace(".", "-").replace("_", "-").replace("+", "-")
Given the new length limit, I think generate_nick is going to have to have some
strategy for dealing with the case where it's seeded with a local part that's
"too long".
>
> person_set = PersonSet()
>
> def _valid_nick(nick):
> - if not valid_name(nick):
> + if not valid_username(nick):
> return False
> elif is_registered(nick):
> return False
--
https://code.launchpad.net/~cprov/launchpad/strict-usernames/+merge/366985
Your team Launchpad code reviewers is subscribed to branch lp:launchpad.
_______________________________________________
Mailing list: https://launchpad.net/~launchpad-reviewers
Post to : [email protected]
Unsubscribe : https://launchpad.net/~launchpad-reviewers
More help : https://help.launchpad.net/ListHelp