mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-12 09:23:09 -06:00
Fix error messages and incorrect test
This commit is contained in:
parent
eb4adc7852
commit
debd108ac5
|
|
@ -187,12 +187,12 @@ func validateUsername(username string) *util.JSONResponse {
|
|||
} else if !validUsernameRegex.MatchString(username) {
|
||||
return &util.JSONResponse{
|
||||
Code: http.StatusBadRequest,
|
||||
JSON: jsonerror.InvalidUsername("User ID can only contain characters a-z, 0-9, or '_-./'"),
|
||||
JSON: jsonerror.InvalidUsername("Username can only contain characters a-z, 0-9, or '_-./'"),
|
||||
}
|
||||
} else if username[0] == '_' { // Regex checks its not a zero length string
|
||||
return &util.JSONResponse{
|
||||
Code: http.StatusBadRequest,
|
||||
JSON: jsonerror.InvalidUsername("User ID cannot start with a '_'"),
|
||||
JSON: jsonerror.InvalidUsername("Username cannot start with a '_'"),
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
|
@ -208,7 +208,7 @@ func validateApplicationServiceUsername(username string) *util.JSONResponse {
|
|||
} else if !validUsernameRegex.MatchString(username) {
|
||||
return &util.JSONResponse{
|
||||
Code: http.StatusBadRequest,
|
||||
JSON: jsonerror.InvalidUsername("User ID can only contain characters a-z, 0-9, or '_-./'"),
|
||||
JSON: jsonerror.InvalidUsername("Username can only contain characters a-z, 0-9, or '_-./'"),
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ func TestValidationOfApplicationServices(t *testing.T) {
|
|||
|
||||
// Create a fake application service
|
||||
fakeID := "FakeAS"
|
||||
fakeSenderLocalpart := "@_appservice_bot"
|
||||
fakeSenderLocalpart := "_appservice_bot"
|
||||
fakeApplicationService := config.ApplicationService{
|
||||
ID: fakeID,
|
||||
URL: "null",
|
||||
|
|
|
|||
Loading…
Reference in a new issue