Browse Source

decrement accessk key on use

Anish Mukherjee 2 years ago
parent
commit
0049c2bcad
1 changed files with 2 additions and 0 deletions
  1. 2 0
      controllers/node.go

+ 2 - 0
controllers/node.go

@@ -176,6 +176,7 @@ func nodeauth(next http.Handler) http.HandlerFunc {
 			for _, key := range network.AccessKeys {
 				if key.Value == token {
 					found = true
+					logic.DecrimentKey(network.NetID, key.Value)
 					break
 				}
 			}
@@ -188,6 +189,7 @@ func nodeauth(next http.Handler) http.HandlerFunc {
 			logic.ReturnErrorResponse(w, r, errorResponse)
 			return
 		}
+
 		next.ServeHTTP(w, r)
 	}
 }