From 4f217781cc84a8f3b009d1b38e0032e99d2b9245 Mon Sep 17 00:00:00 2001 From: Howl Date: Tue, 9 Aug 2016 19:22:41 +0200 Subject: [PATCH] GET /tokens/self now returns 404 if no token is given --- app/v1/token.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/v1/token.go b/app/v1/token.go index 0827c08..47d33e2 100644 --- a/app/v1/token.go +++ b/app/v1/token.go @@ -177,6 +177,9 @@ type tokenSingleResponse struct { // TokenSelfGET retrieves information about the token the user is connecting with. func TokenSelfGET(md common.MethodData) common.CodeMessager { + if md.ID() == 0 { + return common.SimpleResponse(404, "How are we supposed to find the token you're using if you ain't even using one?!") + } var r tokenSingleResponse // md.User.ID = token id, userid would have been md.User.UserID. what a clusterfuck err := md.DB.QueryRow("SELECT id, privileges, description FROM tokens WHERE id = ?", md.User.ID).Scan(