feat: fix check bug to allow logged-in users to buy product (#3897)

This commit is contained in:
XiangYe
2025-06-25 10:49:20 +08:00
committed by GitHub
parent 4307baa759
commit b36fb50239

View File

@ -182,7 +182,7 @@ func (c *ApiController) BuyProduct() {
paidUserName := c.Input().Get("userName")
owner, _ := util.GetOwnerAndNameFromId(id)
userId := util.GetId(owner, paidUserName)
if paidUserName != "" && !c.IsAdmin() {
if paidUserName != "" && paidUserName != c.GetSessionUsername() && !c.IsAdmin() {
c.ResponseError(c.T("general:Only admin user can specify user"))
return
}