Keep a jQuery object of hidden login form

This commit is contained in:
Neil Lalonde 2013-03-14 11:03:30 -04:00
parent d398d13aed
commit 91bd27ec0a
1 changed files with 5 additions and 4 deletions

View File

@ -57,10 +57,11 @@ Discourse.LoginView = Discourse.ModalBodyView.extend({
_this.flash(result.error, 'error'); _this.flash(result.error, 'error');
} else { } else {
// Trigger the browser's password manager using the hidden static login form: // Trigger the browser's password manager using the hidden static login form:
$('#hidden-login-form input[name=username]').val(_this.get('loginName')); var $hidden_login_form = $('#hidden-login-form');
$('#hidden-login-form input[name=password]').val(_this.get('loginPassword')); $hidden_login_form.find('input[name=username]').val(_this.get('loginName'));
$('#hidden-login-form input[name=redirect]').val(window.location.href); $hidden_login_form.find('input[name=password]').val(_this.get('loginPassword'));
$('#hidden-login-form').submit(); $hidden_login_form.find('input[name=redirect]').val(window.location.href);
$hidden_login_form.submit();
} }
}).fail(function(result) { }).fail(function(result) {
_this.flash(Em.String.i18n('login.error'), 'error'); _this.flash(Em.String.i18n('login.error'), 'error');