계정 제재 오류 수정
This commit is contained in:
@ -169,7 +169,11 @@ func (caller apiCaller) blockAPI(w http.ResponseWriter, r *http.Request) error {
|
|||||||
json.NewEncoder(w).Encode(mg.bl.all())
|
json.NewEncoder(w).Encode(mg.bl.all())
|
||||||
} else if !target.IsZero() {
|
} else if !target.IsZero() {
|
||||||
if blocked, ok := mg.bl.get(target); ok && blocked != nil {
|
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" {
|
} 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)
|
logger.Println("account is blocked :", meta)
|
||||||
|
|
||||||
bi.Accid = accid
|
bi.Accid = accid
|
||||||
caller.mg.bl.add(&bi)
|
|
||||||
mg.sessionProvider.RevokeAll(accid)
|
mg.sessionProvider.RevokeAll(accid)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -226,8 +229,6 @@ func (caller apiCaller) blockAPI(w http.ResponseWriter, r *http.Request) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
caller.mg.bl.remove(idobj)
|
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user