Compare commits

..

No commits in common. "ad30583265f838edd60f3ce2026db60de0f9df96" and "5080c566ac31ec622986c04f1812a1e88c88210e" have entirely different histories.

3 changed files with 12 additions and 14 deletions

View File

@ -27,8 +27,8 @@ func validateGuestbookEntry(entry *database.GuestbookEntry) []string {
}
messageLength := len(entry.Message)
if messageLength > 500 {
errors = append(errors, "message cannot be longer than 500 characters")
if messageLength < 10 || messageLength > 500 {
errors = append(errors, "message must be between 10 and 500 characters")
}
newLines := strings.Count(entry.Message, "\n")
@ -58,17 +58,19 @@ func SignGuestbookContinuation(context *RequestContext, req *http.Request, resp
Name: name,
Message: message,
}
formErrors.Errors = append(formErrors.Errors, validateGuestbookEntry(entry)...)
if len(formErrors.Errors) > 0 {
(*context.TemplateData)["FormError"] = formErrors
return failure(context, req, resp)
}
err := verifyHCaptcha(context.Args.HcaptchaSecret, hCaptchaResponse)
if err != nil {
log.Println(err)
formErrors.Errors = append(formErrors.Errors, "hCaptcha verification failed")
}
if len(formErrors.Errors) > 0 {
(*context.TemplateData)["FormError"] = formErrors
(*context.TemplateData)["EntryForm"] = entry
resp.WriteHeader(http.StatusBadRequest)
return failure(context, req, resp)
}

View File

@ -23,12 +23,6 @@ func resolveRecursive(dbConn *sql.DB, dnsResolvers []string, domain string, qtyp
answers := []dns.RR{}
for _, record := range internalCnames {
cname, err := dns.NewRR(fmt.Sprintf("%s %d IN CNAME %s", record.Name, record.TTL, record.Content))
if err != nil {
return nil, err
}
answers = append(answers, cname)
cnameRecursive, _ := resolveRecursive(dbConn, dnsResolvers, record.Content, qtype, maxDepth-1)
answers = append(answers, cnameRecursive...)
}

View File

@ -17,7 +17,9 @@
{{ if not .EntryForm }}
placeholder="hoi!"
{{ end }}
>{{ if .EntryForm }}{{ .EntryForm.Message }}{{ end }}</textarea>
>{{ if .EntryForm }}{{ .EntryForm.Message }}{{ end }}
</textarea>
<div
class="h-captcha"
data-sitekey="{{ .HcaptchaArgs.SiteKey }}"