fix 3
check help value when parsing solution
This commit is contained in:
10
klice.go
10
klice.go
@@ -43,9 +43,11 @@ func loginHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
default:
|
default:
|
||||||
sessionID := hashedPassword
|
sessionID := hashedPassword
|
||||||
cookie := &http.Cookie{
|
cookie := &http.Cookie{
|
||||||
Name: "session_id",
|
Name: "session_id",
|
||||||
Value: sessionID,
|
Value: sessionID,
|
||||||
Path: "/",
|
Path: "/",
|
||||||
|
HttpOnly: true,
|
||||||
|
SameSite: http.SameSiteStrictMode,
|
||||||
}
|
}
|
||||||
http.SetCookie(w, cookie)
|
http.SetCookie(w, cookie)
|
||||||
|
|
||||||
@@ -249,7 +251,7 @@ func qrHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
help = 2
|
help = 2
|
||||||
db.Exec("UPDATE penalties SET minutes = 30 WHERE team_id = ? AND task_id = ?", teamID, taskID)
|
db.Exec("UPDATE penalties SET minutes = 30 WHERE team_id = ? AND task_id = ?", teamID, taskID)
|
||||||
db.Exec("UPDATE teams SET penalty = penalty + 30, last_cipher = ? WHERE id = ?", order+1, teamID)
|
db.Exec("UPDATE teams SET penalty = penalty + 30, last_cipher = ? WHERE id = ?", order+1, teamID)
|
||||||
} else if answer := r.FormValue("solution"); answer != "" { // answer submission
|
} else if answer := r.FormValue("solution"); answer != "" && help < 2 { // answer submission
|
||||||
var correctAnswer string
|
var correctAnswer string
|
||||||
err = db.QueryRow("SELECT solution FROM CIPHERS WHERE id = ?", cipherID).Scan(&correctAnswer)
|
err = db.QueryRow("SELECT solution FROM CIPHERS WHERE id = ?", cipherID).Scan(&correctAnswer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user