Browse Source

minor improvements

master
Christian Müller 8 years ago
parent
commit
fa158f485a
  1. 2
      assets/templates/form.html
  2. 2
      email.go
  3. 1
      server.go

2
assets/templates/form.html

@ -20,7 +20,7 @@ @@ -20,7 +20,7 @@
Accept <a href="/TOS.md">Terms of Service</a>
</label>
<div id="captcha" class="g-recaptcha" data-sitekey="6LemnDEUAAAAAC6A4VNRefz0BSLiC343W4sXQd6I"></div>
<input class="button ui-elem" disabled id="publish-button" name="button" type="submit" value="Publish" />
<input class="button ui-elem" disabled id="publish-button" name="button" type="submit" value="Publish Note" />
</fieldset>
</form>
<footer>

2
email.go

@ -10,7 +10,7 @@ func email(id, text string) error { @@ -10,7 +10,7 @@ func email(id, text string) error {
smtpServer := os.Getenv("SMTP_SERVER")
auth := smtp.PlainAuth("", os.Getenv("SMTP_USER"), os.Getenv("SMTP_PASSWORD"), smtpServer)
to := []string{os.Getenv("NOTEHUB_ADMIN_EMAIL")}
msg := []byte("Subject: note reported\r\n\r\n" +
msg := []byte("Subject: Note reported\r\n\r\n" +
fmt.Sprintf("Note https://notehub.org/%s was reported: %q\r\n", id, text))
return smtp.SendMail(smtpServer+":587", auth, to[0], to, msg)
}

1
server.go

@ -107,7 +107,6 @@ func main() { @@ -107,7 +107,6 @@ func main() {
e.POST("/note", func(c echo.Context) error {
c.Logger().Debug("POST /note requested")
if !skipCaptcha && !checkRecaptcha(c, c.FormValue("g-recaptcha-response")) {
c.Logger().Warnf("captcha validation failed for %s", c.Request().RemoteAddr)
code := http.StatusForbidden
return c.Render(code, "Note", responsePage(code))
}

Loading…
Cancel
Save