small response stuff

This commit is contained in:
grumbulon 2022-12-30 23:22:44 -05:00
parent f469d20e06
commit 11692efdd1
3 changed files with 5 additions and 6 deletions

View file

@ -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"])))
}

View file

@ -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)

View file

@ -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 {