diff --git a/CHANGELOG.md b/CHANGELOG.md index 992a1005..4543a0f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ All notable changes to this project will be documented in this file. - Add Go usage example - Send monthly reports on 1st of every month, not randomly during the month - Signup form sets the "auto-login" cookie to avoid an extra click during first login +- Autofocus the email field in the signup form, and submit on enter key ### Bug Fixes - Prevent double-clicking the submit button in signup form diff --git a/static/js/signup.js b/static/js/signup.js index 92323863..80078dfa 100644 --- a/static/js/signup.js +++ b/static/js/signup.js @@ -1,6 +1,6 @@ $(function () { - $("#signup-go").on("click", function() { + function submitForm() { var base = document.getElementById("base-url").getAttribute("href").slice(0, -1); var email = $("#signup-email").val(); var token = $('input[name=csrfmiddlewaretoken]').val(); @@ -18,6 +18,18 @@ $(function () { }); return false; + } + + $("#signup-go").on("click", submitForm); + + $("#signup-email").keypress(function (e) { + if (e.which == 13) { + return submitForm(); + } }); + $("#signup-modal").on('shown.bs.modal', function () { + $("#signup-email").focus() + }) + }); \ No newline at end of file