Fix coupon form a bit

This commit is contained in:
2021-11-29 23:32:25 +01:00
parent ef083ff087
commit d37bddb720
3 changed files with 11 additions and 3 deletions

View File

@@ -226,6 +226,15 @@ func (wc *WebController) couponForm(td *TemplateData, r *http.Request) (f Form)
return f
}
if !td.Authenticated {
f.Submitted = true
f.SubmitMessages = []template.HTML{
`You need to log in to a pixeldrain account to use the coupon. ` +
`<a href="/login">Click here to log in</a>`,
}
return f
}
if f.ReadInput(r) {
if err := td.PixelAPI.PostCouponRedeem(r.FormValue("code")); err != nil {
formAPIError(err, &f)