Do not expose password hashes over API

This commit is contained in:
eikendev 2020-08-04 23:38:46 +02:00
parent e4e87f2710
commit 505cf4a519
No known key found for this signature in database
GPG key ID: A1BDB1B28C8EF694

View file

@ -138,7 +138,13 @@ func (h *UserHandler) GetUsers(ctx *gin.Context) {
return
}
ctx.JSON(http.StatusOK, &users)
var externalUsers []*model.ExternalUser
for _, user := range users {
externalUsers = append(externalUsers, user.IntoExternalUser())
}
ctx.JSON(http.StatusOK, &externalUsers)
}
// GetUser returns the user with the specified ID.
@ -149,7 +155,7 @@ func (h *UserHandler) GetUser(ctx *gin.Context) {
return
}
ctx.JSON(http.StatusOK, user)
ctx.JSON(http.StatusOK, user.IntoExternalUser())
}
// DeleteUser deletes a user with a certain ID.