Rate limit login stuff

This commit is contained in:
bel
2019-10-22 02:12:27 +00:00
parent cc41444b21
commit 80017bb32b
3 changed files with 11 additions and 3 deletions

View File

@@ -13,6 +13,7 @@ import (
)
func (s *Server) usersLog(w http.ResponseWriter, r *http.Request) {
s.limiter.Wait(r.Context())
q := r.URL.Query()
fmt.Fprintln(w, `
<html>
@@ -27,6 +28,7 @@ func (s *Server) usersLog(w http.ResponseWriter, r *http.Request) {
}
func (s *Server) usersRegister(w http.ResponseWriter, r *http.Request) {
s.limiter.Wait(r.Context())
fmt.Fprintln(w, `
<html>
<body>
@@ -40,6 +42,7 @@ func (s *Server) usersRegister(w http.ResponseWriter, r *http.Request) {
}
func (s *Server) usersSubmit(w http.ResponseWriter, r *http.Request) {
s.limiter.Wait(r.Context())
if r.Method != "POST" {
http.NotFound(w, r)
return