graph: Allow creating users without email (#5253)

This commit is contained in:
Daniel Swärd
2023-01-19 12:52:03 +01:00
committed by Ralf Haferkamp
parent b30b0b4a6c
commit c79d4ec241
3 changed files with 1 additions and 8 deletions

View File

@@ -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))
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

View File

@@ -512,9 +512,6 @@ var _ = Describe("Users", func() {
})
It("handles bad Mails", func() {
user.Mail = nil
assertHandleBadAttributes(user)
user.SetMail("not-a-mail-address")
assertHandleBadAttributes(user)
})

View File

@@ -24,7 +24,7 @@ Feature: create user
| withoutPassSameEmail | without pass | alice@example.org | | 200 | should |
| name | pass with space | example@example.org | my pass | 200 | should |
| 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 |
| name with space | name with space | example@example.org | 123 | 400 | should not |