diff --git a/apps/users/templates/users/profile_form.html b/apps/users/templates/users/profile_form.html index 7f7173fbfd..f3d429c441 100644 --- a/apps/users/templates/users/profile_form.html +++ b/apps/users/templates/users/profile_form.html @@ -15,6 +15,6 @@
diff --git a/media/js/zamboni/browserid_support.js b/media/js/zamboni/browserid_support.js index e8521ff43f..1765a4755b 100644 --- a/media/js/zamboni/browserid_support.js +++ b/media/js/zamboni/browserid_support.js @@ -125,17 +125,17 @@ function completeUserProfile(options) { function loadProfileCompletionForm($root, options) { if (!options) options = {}; var $error = $('.notification-box.error', $root), - win = options.window || window; - + win = options.window || window, + $form = $('form', $root), + handler; $('#browserid-login').hide(); // Don't let people log in twice; will cause error + $root.slideDown(); $(window).trigger('resize'); // I hate this so much. I vow to someday fix this properly. - $('input[type="text"]', $root).eq(0).focus(); - $('form', $root).submit(function(evt) { - var $form = $(this); + function handler(evt) { evt.preventDefault(); $error.hide(); - $('button[type="submit"]', $form).addClass('loading-submit'); + $('a.complete-profile', $form).addClass('loading-submit'); $.ajax({url: $form.attr('action'), type: 'POST', data: $form.serialize(), @@ -176,7 +176,9 @@ function loadProfileCompletionForm($root, options) { $error.html(ul).show(); $form.trigger('badresponse.profile_completion'); }); - }); + } + $('a.complete-profile', $root).click(handler); + $form.submit(handler); } $(document).ready(function () {initBrowserID(window);}); diff --git a/media/js/zamboni/tests/profile_tests.js b/media/js/zamboni/tests/profile_tests.js index fca573d7da..542fb248ee 100644 --- a/media/js/zamboni/tests/profile_tests.js +++ b/media/js/zamboni/tests/profile_tests.js @@ -24,7 +24,7 @@ asyncTest('success -> redirect', function() { $.mockjaxClear(resultMock); start(); }); - $form.trigger('submit'); + $('.complete-profile', sb).trigger('click'); }); asyncTest('success -> callback', function() { @@ -43,7 +43,7 @@ asyncTest('success -> callback', function() { $form.attr('action', '/complete-profile-cb'); loadProfileCompletionForm(sb, {'window': mockWindow, to: {on: redirectOb, fire: 'finish'}}); - $form.trigger('submit'); + $('.complete-profile', sb).trigger('click'); }); asyncTest('success -> object redirect', function() { @@ -61,7 +61,7 @@ asyncTest('success -> object redirect', function() { }); $form.attr('action', '/complete-profile-cb-to'); loadProfileCompletionForm(sb, {'window': mockWindow, to: '/to-elsewhere'}); - $form.trigger('submit'); + $('.complete-profile', sb).trigger('click'); }); asyncTest('form error', function() { @@ -79,7 +79,7 @@ asyncTest('form error', function() { $.mockjaxClear(resultMock); start(); }); - $form.trigger('submit'); + $('.complete-profile', sb).trigger('click'); }); asyncTest('internal error', function() { @@ -95,7 +95,7 @@ asyncTest('internal error', function() { $.mockjaxClear(resultMock); start(); }); - $form.trigger('submit'); + $('.complete-profile', sb).trigger('click'); }); module('profile form load', { diff --git a/templates/qunit/qunit.html b/templates/qunit/qunit.html index d2e10785ac..959a997b08 100644 --- a/templates/qunit/qunit.html +++ b/templates/qunit/qunit.html @@ -186,7 +186,7 @@ - + Complete Profile @@ -201,7 +201,7 @@ data-post-login-url="/elsewhere"> - + Complete Profile