mirror of
https://github.com/pushbits/server.git
synced 2025-05-03 20:26:23 +02:00
Do not expose password hashes over API
This commit is contained in:
parent
e4e87f2710
commit
505cf4a519
1 changed files with 8 additions and 2 deletions
10
api/user.go
10
api/user.go
|
@ -138,7 +138,13 @@ func (h *UserHandler) GetUsers(ctx *gin.Context) {
|
||||||
return
|
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.
|
// GetUser returns the user with the specified ID.
|
||||||
|
@ -149,7 +155,7 @@ func (h *UserHandler) GetUser(ctx *gin.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.JSON(http.StatusOK, user)
|
ctx.JSON(http.StatusOK, user.IntoExternalUser())
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteUser deletes a user with a certain ID.
|
// DeleteUser deletes a user with a certain ID.
|
||||||
|
|
Loading…
Add table
Reference in a new issue