Merge pull request #7707 from renmaosheng/harbor-6838

Don't display password when calling api/users API.
This commit is contained in:
Daniel Jiang 2019-05-08 12:50:39 +08:00 committed by GitHub
commit 58aed3dde9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -203,7 +203,10 @@ func (ua *UserAPI) List() {
ua.SendInternalServerError(fmt.Errorf("failed to get users: %v", err)) ua.SendInternalServerError(fmt.Errorf("failed to get users: %v", err))
return return
} }
for i := range users {
user := &users[i]
user.Password = ""
}
ua.SetPaginationHeader(total, page, size) ua.SetPaginationHeader(total, page, size)
ua.Data["json"] = users ua.Data["json"] = users
ua.ServeJSON() ua.ServeJSON()