Tìm kiếm hỗ trợ

Tránh các lừa đảo về hỗ trợ. Chúng tôi sẽ không bao giờ yêu cầu bạn gọi hoặc nhắn tin đến số điện thoại hoặc chia sẻ thông tin cá nhân. Vui lòng báo cáo hoạt động đáng ngờ bằng cách sử dụng tùy chọn "Báo cáo lạm dụng".

Learn More

Website with silly login form confuses username completion

  • 2 trả lời
  • 1 gặp vấn đề này
  • 8 lượt xem
  • Trả lời mới nhất được viết bởi 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

Giải pháp được chọn

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);
Đọc câu trả lời này trong ngữ cảnh 👍 0

Tất cả các câu trả lời (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];

Được chỉnh sửa bởi cor-el vào

more options

Giải pháp được chọn

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