diff --git a/hub/handlers.go b/hub/handlers.go index 20b5391..af7a262 100644 --- a/hub/handlers.go +++ b/hub/handlers.go @@ -248,6 +248,7 @@ func (a *App) _adminPasswordSubmit(s *api.Session, w http.ResponseWriter, r *htt return err } + // 72 is max password length for bcrypt. if len(newPwd) < 8 || len(newPwd) > 72 { return errs.ErrInvalidPassword } @@ -281,8 +282,7 @@ func (a *App) _adminPasswordSubmit(s *api.Session, w http.ResponseWriter, r *htt func (a *App) _peerInit(peer *api.Peer, w http.ResponseWriter, r *http.Request) error { if len(peer.WGPubKey) != 0 { - http.Error(w, "Already initialized", http.StatusConflict) - return nil + return errs.BadRequest.WithMsg("Already initialized") } r.Body = http.MaxBytesReader(w, r.Body, 2048) @@ -293,12 +293,10 @@ func (a *App) _peerInit(peer *api.Peer, w http.ResponseWriter, r *http.Request) } if len(args.WGPubKey) != 32 { - http.Error(w, "invalid WGPubKey", http.StatusBadRequest) - return nil + return errs.BadRequest.WithMsg("Invalid WGPubKey.") } if len(args.SignPubKey) != 32 { - http.Error(w, "invalid SignPubKey", http.StatusBadRequest) - return nil + return errs.BadRequest.WithMsg("Invalid SignPubKey.") } net, err := a.api.Network_Get(peer.NetworkID) diff --git a/hub/templates/base.html b/hub/templates/base.html index 56ab567..d2d186d 100644 --- a/hub/templates/base.html +++ b/hub/templates/base.html @@ -10,7 +10,7 @@
No peers.