Added a remove
URL query parameter for IsSolved() handler. Calls a Remove() method of a DB.
This commit is contained in:
parent
ae67f6aa4f
commit
0b064e8977
@ -60,6 +60,15 @@ func (h *CaptchaHandlers) Solve(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
func (h *CaptchaHandlers) IsSolved(w http.ResponseWriter, r *http.Request) {
|
func (h *CaptchaHandlers) IsSolved(w http.ResponseWriter, r *http.Request) {
|
||||||
captchaID := pcaptcha.ID(server.GetURLParam(r, "captcha"))
|
captchaID := pcaptcha.ID(server.GetURLParam(r, "captcha"))
|
||||||
|
isJustRemove := r.URL.Query().Has("remove")
|
||||||
|
|
||||||
|
if isJustRemove {
|
||||||
|
err := captcha.Remove(captchaID)
|
||||||
|
if err != nil {
|
||||||
|
w.WriteHeader(http.StatusNotFound)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
solved, err := captcha.IsSolved(captchaID)
|
solved, err := captcha.IsSolved(captchaID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user