diff --git a/README.md b/README.md index 37013ec..20685cb 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Extremely simple contact form with a CAPTCHA. Entries are sent to the specified HTTP endpoint. -JavaScript is not required to fill out the form, but if it is, then form fields are cached in localStorage. +JavaScript is not required to fill out the form, but if it is, then form fields are cached in sessionStorage. ## Building diff --git a/main.py b/main.py index 1de30e3..7581a8d 100644 --- a/main.py +++ b/main.py @@ -32,7 +32,7 @@ def index(): message = message.replace("<", "<").replace(">", ">").replace("&", "&") if message != "": requests.post(HTTP_ENDPOINT, data={'subject': 'New Simple Contact message', 'message': message}) - return render_template('message.html', message = "Your message was sent successfully", success=True) + return render_template('message.html', message = "Your message was sent successfully") else: raise TypeError("Invalid method") except Exception as e: diff --git a/templates/index.html b/templates/index.html index c67c2c3..3a775db 100644 --- a/templates/index.html +++ b/templates/index.html @@ -43,13 +43,13 @@ Array.from(document.querySelectorAll('form .' + fc)).forEach(element => { let elementName = fc + '-' + location.pathname + '#' + element.id // Load from cache - let cached = localStorage.getItem(elementName) + let cached = sessionStorage.getItem(elementName) if (cached != null) { element.value = cached } // Auto save to cache element.addEventListener('input', function () { - localStorage.setItem(elementName, element.value) + sessionStorage.setItem(elementName, element.value) }) }) })() diff --git a/templates/message.html b/templates/message.html index a304475..1b7b6b5 100644 --- a/templates/message.html +++ b/templates/message.html @@ -30,12 +30,6 @@ Go back to homepage {% endif %} - {% if success %} - - {% endif %} -