Merge lp:~waigani/juju-core/change-user-regex into lp:~go-bot/juju-core/trunk
Proposed by
Jesse Meek
Status: | Work in progress |
---|---|
Proposed branch: | lp:~waigani/juju-core/change-user-regex |
Merge into: | lp:~go-bot/juju-core/trunk |
Diff against target: |
58 lines (+16/-11) 2 files modified
names/user.go (+1/-1) names/user_test.go (+15/-10) |
To merge this branch: | bzr merge lp:~waigani/juju-core/change-user-regex |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju Engineering | Pending | ||
Review via email: mp+220896@code.launchpad.net |
Description of the change
names/user: Update regex
Update username regex to allow launchpad
usernames, which use the following regex:
r"^[a-z0-
To post a comment you must log in.
Unmerged revisions
- 2790. By Jesse Meek
-
Update regex to allow lp username policy
Reviewers: mp+220896_ code.launchpad. net,
Message:
Please take a look.
Description:
names/user: Update regex
Update username regex to allow launchpad 9][a-z0- 9\+\.\- ]+$"
usernames, which use the following regex:
r"^[a-z0-
https:/ /code.launchpad .net/~waigani/ juju-core/ change- user-regex/ +merge/ 220896
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/100800043/
Affected files (+18, -11 lines):
A [revision details]
M names/user.go
M names/user_test.go
Index: [revision details] 20140526011313- 826c14om0palwq0 z
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: tarmac-
+New revision: <email address hidden>
Index: names/user.go
=== modified file 'names/user.go'
--- names/user.go 2014-05-21 22:02:21 +0000
+++ names/user.go 2014-05-26 02:17:41 +0000
@@ -7,7 +7,7 @@
"regexp"
)
-var validName = regexp. MustCompile( "^[a-zA- Z][a-zA- Z0-9.-] *[a-zA- Z0-9]$" ) MustCompile( "^[a-zA- Z0-9][a- zA-Z0-9+ .-]*$")
+var validName = regexp.
// IsUser returns whether id is a valid user id.
func IsUser(name string) bool {
Index: names/user_test.go user_test. go'
=== modified file 'names/
--- names/user_test.go 2014-05-22 00:48:08 +0000
+++ names/user_test.go 2014-05-26 02:17:41 +0000
@@ -24,18 +24,18 @@
{"b^b", false},
{"bob1", true},
{"bob-1", true},
- {"bob+1", false},
+ {"bob+1", true},
{"bob.1", true},
- {"1bob", false},
- {"1-bob", false},
- {"1+bob", false},
- {"1.bob", false},
- {"jim.bob+99-1.", false},
- {"a", false},
- {"0foo", false},
+ {"1bob", true},
+ {"1-bob", true},
+ {"1+bob", true},
+ {"1.bob", true},
+ {"jim.bob+99-1.", true},
+ {"a", true},
+ {"0foo", true},
{"foo bar", false},
{"bar{}", false},
- {"bar+foo", false},
+ {"bar+foo", true},
{"bar_foo", false},
{"bar!", false},
{"bar^", false},
@@ -48,7 +48,12 @@
{"&bar", false},
{"#1foo", false},
{"<email address hidden>", false},
- {"not/valid", false},
+ {"foo.", true},
+ {"foo+", true},
+ {"foo-", true},
+ {".foo", false},
+ {"+foo", false},
+ {"-foo", false},
}
func (s *userSuite) TestUserTag(c *gc.C) {