graph: Allow creating users without email (#5253)
This commit is contained in:
committed by
Ralf Haferkamp
parent
b30b0b4a6c
commit
c79d4ec241
@@ -188,10 +188,6 @@ func (g Graph) PostUser(w http.ResponseWriter, r *http.Request) {
|
|||||||
errorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, fmt.Sprintf("%v is not a valid email address", *u.Mail))
|
errorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, fmt.Sprintf("%v is not a valid email address", *u.Mail))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
logger.Debug().Interface("user", u).Msg("could not create user: missing required Attribute: 'mail'")
|
|
||||||
errorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, "missing required Attribute: 'mail'")
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disallow user-supplied IDs. It's supposed to be readonly. We're either
|
// Disallow user-supplied IDs. It's supposed to be readonly. We're either
|
||||||
|
|||||||
@@ -512,9 +512,6 @@ var _ = Describe("Users", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("handles bad Mails", func() {
|
It("handles bad Mails", func() {
|
||||||
user.Mail = nil
|
|
||||||
assertHandleBadAttributes(user)
|
|
||||||
|
|
||||||
user.SetMail("not-a-mail-address")
|
user.SetMail("not-a-mail-address")
|
||||||
assertHandleBadAttributes(user)
|
assertHandleBadAttributes(user)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ Feature: create user
|
|||||||
| withoutPassSameEmail | without pass | alice@example.org | | 200 | should |
|
| withoutPassSameEmail | without pass | alice@example.org | | 200 | should |
|
||||||
| name | pass with space | example@example.org | my pass | 200 | should |
|
| name | pass with space | example@example.org | my pass | 200 | should |
|
||||||
| nameWithCharacters(*:!;_+-&) | user | new@example.org | 123 | 400 | should not |
|
| nameWithCharacters(*:!;_+-&) | user | new@example.org | 123 | 400 | should not |
|
||||||
| withoutEmail | without email | | 123 | 400 | should not |
|
| withoutEmail | without email | | 123 | 200 | should |
|
||||||
| Alice | same userName | new@example.org | 123 | 400 | should |
|
| Alice | same userName | new@example.org | 123 | 400 | should |
|
||||||
| name with space | name with space | example@example.org | 123 | 400 | should not |
|
| name with space | name with space | example@example.org | 123 | 400 | should not |
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user