From 91bd27ec0a080c7f2565754b028d0b0153c26d7d Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Thu, 14 Mar 2013 11:03:30 -0400 Subject: [PATCH] Keep a jQuery object of hidden login form --- .../javascripts/discourse/views/modal/login_view.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/discourse/views/modal/login_view.js b/app/assets/javascripts/discourse/views/modal/login_view.js index b510260b592..2b9bbece63c 100644 --- a/app/assets/javascripts/discourse/views/modal/login_view.js +++ b/app/assets/javascripts/discourse/views/modal/login_view.js @@ -57,10 +57,11 @@ Discourse.LoginView = Discourse.ModalBodyView.extend({ _this.flash(result.error, 'error'); } else { // Trigger the browser's password manager using the hidden static login form: - $('#hidden-login-form input[name=username]').val(_this.get('loginName')); - $('#hidden-login-form input[name=password]').val(_this.get('loginPassword')); - $('#hidden-login-form input[name=redirect]').val(window.location.href); - $('#hidden-login-form').submit(); + var $hidden_login_form = $('#hidden-login-form'); + $hidden_login_form.find('input[name=username]').val(_this.get('loginName')); + $hidden_login_form.find('input[name=password]').val(_this.get('loginPassword')); + $hidden_login_form.find('input[name=redirect]').val(window.location.href); + $hidden_login_form.submit(); } }).fail(function(result) { _this.flash(Em.String.i18n('login.error'), 'error');