Support using "?allowEmpty=1" to bypass empty displayName check in update-user API

This commit is contained in:
Yang Luo
2023-09-02 11:59:07 +08:00
parent 6700d2e244
commit e584a6a111
2 changed files with 7 additions and 4 deletions

View File

@ -258,6 +258,13 @@ func (c *ApiController) UpdateUser() {
return
}
if c.Input().Get("allowEmpty") == "" {
if user.DisplayName == "" {
c.ResponseError(c.T("user:Display name cannot be empty"))
return
}
}
if msg := object.CheckUpdateUser(oldUser, &user, c.GetAcceptLanguage()); msg != "" {
c.ResponseError(msg)
return