Fix error reporting on registration.

- fleshed out documentation (fixing #30)
- added forgot page
This commit is contained in:
sm
2016-05-22 23:10:51 -07:00
parent c99f57527f
commit 48d723a582
7 changed files with 202 additions and 100 deletions
+14 -2
View File
@@ -154,7 +154,13 @@ func (s *Server) register(w http.ResponseWriter, req *http.Request) {
proto = "http"
}
log.Printf("%s://%s/api/v0/confirm/%+v", proto, req.Host, tok)
fmt.Fprintf(w, "please check your email\n")
resp := struct {
Msg string `json:"msg"`
}{
Msg: "please check your email\n",
}
w.Header().Set("Content-type", "application/json")
json.NewEncoder(w).Encode(resp)
}
func (s *Server) confirm(w http.ResponseWriter, req *http.Request) {
@@ -192,7 +198,13 @@ func (s *Server) forgot(w http.ResponseWriter, req *http.Request) {
return
}
log.Printf("http://%s/api/v0/confirm/%+v", req.Host, tok)
fmt.Fprintf(w, "please check your email\n")
resp := struct {
Msg string `json:"msg"`
}{
Msg: "please check your email\n",
}
w.Header().Set("Content-type", "application/json")
json.NewEncoder(w).Encode(resp)
}
func (s *Server) pkgs(w http.ResponseWriter, req *http.Request) {
w.Header().Set("Content-type", "application/json")