diff --git a/main.go b/main.go index 2b1fa6e..2d89be2 100644 --- a/main.go +++ b/main.go @@ -365,7 +365,7 @@ func main() { return } session.Set("captcha", data.Text) - session.Set("id", sessionid) + session.Set("unique_token", sessionid) err = session.Save() if err != nil { fmt.Println("[ERROR] Failed to save session in /login at", strconv.FormatInt(time.Now().Unix(), 10)+":", err) @@ -449,8 +449,6 @@ func main() { return } if data["captcha"].(string) != session.Get("captcha") { - fmt.Println(data["captcha"]) - fmt.Println(session.Get("captcha")) c.JSON(401, gin.H{"error": "Captcha failed"}) return } diff --git a/static/js/signup.js b/static/js/signup.js index 6be57e2..3a7d20c 100644 --- a/static/js/signup.js +++ b/static/js/signup.js @@ -102,12 +102,14 @@ signupButton.addEventListener("click", () => { localStorage.setItem("DONOTSHARE-password", await hashwasm.sha512(password)) window.location.href = "/app" + window.location.search - } - else if (response.status === 409) { + } else if (response.status === 409) { statusBox.innerText = "Username already taken!" showElements(true) - } - else { + } else if (response.status === 401) { + statusBox.innerText = "CAPTCHA has expired!" + } else if (response.status === 403) { + statusBox.innerText = "CAPTCHA is incorrect!" + } else { statusBox.innerText = "Something went wrong!" showElements(true) }