mirror of
https://github.com/Rayzggz/server_torii.git
synced 2025-06-21 22:41:31 +08:00
feat: CAPTCHA SESSION
This commit is contained in:
@ -70,6 +70,7 @@ func CheckMain(w http.ResponseWriter, userRequestData dataType.UserRequest, rule
|
||||
http.Error(w, "500 - Internal Server Error", http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
w.Header().Set("Set-Cookie", "__torii_session_id="+string(decision.ResponseData)+"; Path=/; Path=/; Max-Age=86400; Priority=High; HttpOnly;")
|
||||
w.Header().Set("Content-Type", "text/html; charset=utf-8")
|
||||
w.WriteHeader(http.StatusServiceUnavailable)
|
||||
if err = tpl.Execute(w, nil); err != nil {
|
||||
|
@ -28,6 +28,14 @@ func CheckTorii(w http.ResponseWriter, r *http.Request, reqData dataType.UserReq
|
||||
return
|
||||
}
|
||||
return
|
||||
} else if bytes.Compare(decision.ResponseData, []byte("badSession")) == 0 {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
_, err := w.Write([]byte("badSession"))
|
||||
if err != nil {
|
||||
log.Printf("Error writing response: %v", err)
|
||||
return
|
||||
}
|
||||
return
|
||||
} else if bytes.Compare(decision.ResponseData, []byte("good")) == 0 {
|
||||
w.Header().Set("Set-Cookie", "__torii_clearance="+string(check.GenClearance(reqData, *ruleSet))+"; Path=/; Max-Age=86400; Priority=High; HttpOnly;")
|
||||
w.WriteHeader(http.StatusOK)
|
||||
|
Reference in New Issue
Block a user