diff --git a/internal/api/api.go b/internal/api/api.go index 1570dc6..0ec39be 100644 --- a/internal/api/api.go +++ b/internal/api/api.go @@ -72,5 +72,5 @@ func Ingest(w http.ResponseWriter, r *http.Request) { func AuthTest(w http.ResponseWriter, r *http.Request) { _, claims, _ := jwtauth.FromContext(r.Context()) - w.Write([]byte(fmt.Sprintf("protected area. hi %v", claims["user_id"]))) + w.Write([]byte(fmt.Sprintf("protected area. hi %v", claims["username"]))) } diff --git a/internal/api/auth.go b/internal/api/auth.go index 046801b..5c19023 100644 --- a/internal/api/auth.go +++ b/internal/api/auth.go @@ -52,7 +52,6 @@ func Login(w http.ResponseWriter, r *http.Request) { internal.Response{ Message: "Successfully logged in", HTTPResponse: 200, - Username: token, }) http.Redirect(w, r, "/", http.StatusSeeOther) diff --git a/internal/zone.go b/internal/zone.go index 612034d..022c4f4 100644 --- a/internal/zone.go +++ b/internal/zone.go @@ -32,15 +32,15 @@ type Zone struct { type User struct { gorm.Model - Username string `json:"name"` + Username string Password string HashedPassword string } type Response struct { - Username string `json:"username"` - Message string `json:"message"` - HTTPResponse int `json:"status"` + Username string `json:"username,omitempty"` + Message string `json:"message,omitempty"` + HTTPResponse int `json:"status,omitempty"` } func (zone *ZoneRequest) Parse() error {