diff --git a/core/api.go b/core/api.go index 6f9b2d7..9642822 100644 --- a/core/api.go +++ b/core/api.go @@ -169,7 +169,11 @@ func (caller apiCaller) blockAPI(w http.ResponseWriter, r *http.Request) error { json.NewEncoder(w).Encode(mg.bl.all()) } else if !target.IsZero() { if blocked, ok := mg.bl.get(target); ok && blocked != nil { - json.NewEncoder(w).Encode(blocked) + if !blocked.Expired() { + json.NewEncoder(w).Encode(blocked) + } else { + mg.bl.remove(target) + } } } } else if r.Method == "PUT" { @@ -200,7 +204,6 @@ func (caller apiCaller) blockAPI(w http.ResponseWriter, r *http.Request) error { logger.Println("account is blocked :", meta) bi.Accid = accid - caller.mg.bl.add(&bi) mg.sessionProvider.RevokeAll(accid) } } @@ -226,8 +229,6 @@ func (caller apiCaller) blockAPI(w http.ResponseWriter, r *http.Request) error { if err != nil { return err } - - caller.mg.bl.remove(idobj) } return nil }