summaryrefslogtreecommitdiff
path: root/api/keys
diff options
context:
space:
mode:
Diffstat (limited to 'api/keys')
-rw-r--r--api/keys/keys.go9
1 files changed, 4 insertions, 5 deletions
diff --git a/api/keys/keys.go b/api/keys/keys.go
index ad380fc..cef3f3c 100644
--- a/api/keys/keys.go
+++ b/api/keys/keys.go
@@ -62,27 +62,26 @@ func CreateAPIKeyContinuation(context *types.RequestContext, req *http.Request,
func DeleteAPIKeyContinuation(context *types.RequestContext, req *http.Request, resp http.ResponseWriter) types.ContinuationChain {
return func(success types.Continuation, failure types.Continuation) types.ContinuationChain {
- key := req.FormValue("key")
+ apiKey := req.FormValue("key")
- typesKey, err := database.GetAPIKey(context.DBConn, key)
+ key, err := database.GetAPIKey(context.DBConn, apiKey)
if err != nil {
log.Println(err)
resp.WriteHeader(http.StatusInternalServerError)
return failure(context, req, resp)
}
- if (typesKey == nil) || (typesKey.UserID != context.User.ID) {
+ if (key == nil) || (key.UserID != context.User.ID) {
resp.WriteHeader(http.StatusUnauthorized)
return failure(context, req, resp)
}
- err = database.DeleteAPIKey(context.DBConn, key)
+ err = database.DeleteAPIKey(context.DBConn, apiKey)
if err != nil {
log.Println(err)
resp.WriteHeader(http.StatusInternalServerError)
return failure(context, req, resp)
}
- http.Redirect(resp, req, "/keys", http.StatusFound)
return success(context, req, resp)
}
}