Søg i Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Website with silly login form confuses username completion

  • 2 svar
  • 1 har dette problem
  • 9 visninger
  • Seneste svar af 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

Valgt løsning

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);
Læs dette svar i sammenhæng 👍 0

Alle svar (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];

Ændret af cor-el den

more options

Valgt løsning

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);