mirror of
https://github.com/mainnika/a-quest.git
synced 2026-07-03 17:42:33 +00:00
add delay task1 answer check
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
|||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"math/rand"
|
||||||
"net/http"
|
"net/http"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -100,6 +101,8 @@ func (a *Api) checkAnswer(ctx *routing.Context) (err error) {
|
|||||||
log.Debugf("req answer, %v", answer)
|
log.Debugf("req answer, %v", answer)
|
||||||
log.Debugf("req hashed, %s", hexed)
|
log.Debugf("req hashed, %s", hexed)
|
||||||
|
|
||||||
|
time.Sleep(time.Second + (time.Millisecond * time.Duration(rand.Intn(500))))
|
||||||
|
|
||||||
valid := subtle.ConstantTimeCompare(a.Answer, hexed)
|
valid := subtle.ConstantTimeCompare(a.Answer, hexed)
|
||||||
if valid == 0 {
|
if valid == 0 {
|
||||||
return routing.NewHTTPError(http.StatusForbidden)
|
return routing.NewHTTPError(http.StatusForbidden)
|
||||||
|
|||||||
Reference in New Issue
Block a user