Unbind click handler on next-courseware-button to prevent repeated presses from advancing more than one challenge

This commit is contained in:
terakilobyte
2015-05-26 12:32:50 -04:00
parent 9a7a8bacfc
commit fa43dd1051
2 changed files with 5 additions and 0 deletions

View File

@ -148,6 +148,7 @@ function showCompletion() {
$('body').keydown(function(e) { $('body').keydown(function(e) {
if (e.ctrlKey && e.keyCode == 13) { if (e.ctrlKey && e.keyCode == 13) {
$('#next-courseware-button').click(); $('#next-courseware-button').click();
$('#next-courseware-button').unbind('click');
} }
}); });
} }

View File

@ -154,6 +154,7 @@ $(document).ready(function() {
'BONFIRE': 5 'BONFIRE': 5
}; };
$('#next-courseware-button').on('click', function() { $('#next-courseware-button').on('click', function() {
$('#next-courseware-button').unbind('click');
if ($('.signup-btn-nav').length < 1) { if ($('.signup-btn-nav').length < 1) {
switch (challengeType) { switch (challengeType) {
case challengeTypes.HTML_CSS_JQ: case challengeTypes.HTML_CSS_JQ:
@ -172,6 +173,9 @@ $(document).ready(function() {
if (res) { if (res) {
window.location.href = '/challenges/next-challenge'; window.location.href = '/challenges/next-challenge';
} }
}).fail(
function() {
window.location.href="/challenges";
} }
); );
break; break;