搜尋 Mozilla 技術支援網站

防止技術支援詐騙。我們絕對不會要求您撥打電話或發送簡訊,或是提供個人資訊。請用「回報濫用」功能回報可疑的行為。

Learn More

Website with silly login form confuses username completion

  • 2 回覆
  • 1 有這個問題
  • 6 次檢視
  • 最近回覆由 cor-el

more options

Hey!

The UK Met Office (UKMO) has a General Aviation (GA) service where they publish weather charts and such: https://www.metoffice.gov.uk/services/transport/aviation/regulated/aviation-briefing-service-guidance It's a free service, anyone can create an account.

The login page, however, has a slightly odd way of collecting the username and password: https://logon.metoffice.gov.uk/Login?goto=http://www.metoffice.gov.uk/premium/myservices/

On that page, there are two <form>s, each containing an <input> element, one for the username and one for the password. The login button is just some javascript which fills in a third, hidden form and POSTs it. Once I have logged in and Firefox has offered to save the password for me (I have to tell it my username because the forms confuse this step too), it never manages to complete both forms. It only autocompletes the password.

Is it possible for Firefox to learn how to cope with this form? I suspect convincing UKMO to fix their website is unlikely, and they're probably not the only offender...

Bruce

Hey! The UK Met Office (UKMO) has a General Aviation (GA) service where they publish weather charts and such: https://www.metoffice.gov.uk/services/transport/aviation/regulated/aviation-briefing-service-guidance It's a free service, anyone can create an account. The login page, however, has a slightly odd way of collecting the username and password: https://logon.metoffice.gov.uk/Login?goto=http://www.metoffice.gov.uk/premium/myservices/ On that page, there are two <form>s, each containing an <input> element, one for the username and one for the password. The login button is just some javascript which fills in a third, hidden form and POSTs it. Once I have logged in and Firefox has offered to save the password for me (I have to tell it my username because the forms confuse this step too), it never manages to complete both forms. It only autocompletes the password. Is it possible for Firefox to learn how to cope with this form? I suspect convincing UKMO to fix their website is unlikely, and they're probably not the only offender... Bruce

被選擇的解決方法

I've edited the JavaScript in my above reply to make it more general where to inject the field.

  • document.querySelectorAll('form[onsubmit] input[type="text"]')[0].parentNode.appendChild(e);
從原來的回覆中察看解決方案 👍 0

所有回覆 (2)

more options

A possible workaround is to add a hidden password field in the first form to make Firefox recognize it as a login form You can create a new bookmark and paste the JavaScript code in its Location field.

javascript:(function(){var e=document.createElement('input');e.hidden="true";e.type="password";document.querySelectorAll('form[onsubmit] input[type="text"]')[0].parentNode.appendChild(e);})()

The JavaScript code only copies the first element to the hidden Login form and ignores this extra input field, so there shouldn't be a problem.

  • frms = document.forms;i=1;frm=frms['frm' + i];frm.elements[0];

由 cor-el 於 修改

more options

選擇的解決方法

I've edited the JavaScript in my above reply to make it more general where to inject the field.

  • document.querySelectorAll('form[onsubmit] input[type="text"]')[0].parentNode.appendChild(e);