Reputation: 487
I'm just trying to submit the already-filled-out login form at this site: http://portal.mypearson.com/mypearson-login.jsp
In firefox console, I can type this: doSubmit(); and it works fine but it doesn't work in greasemonkey. By 'doesn't work' I mean nothing happens. I can do document.forms[0].submit() but the page comes back complaining that the user and pass variables aren't set correctly.
What do I need to do to get the script that works in console to work in greasemonkey?
Upvotes: 0
Views: 242
Reputation: 46
Have you tried taking the functionality from the doSubmit() function and performing those actions?
A quick inspection of the code looks like this:
if (!validate(displayForm)) {return false;}
loginForm.loginname.value = displayForm.loginname.value;
loginForm.password.value = hex_md5(displayForm.password.value.toLowerCase());
loginForm.encPassword.value = 'Y';
loginForm.submit();
return true;
It looks like the form is actually just copying its values to another form and then submitting the other form.
You could first start by removing the onsubmit event by using:
displayForm.setAttribute("onsubmit", null)
Or you could just bypass the display form all together and go straight to the source. Your greasemonkey script would look something like this without all the extra steps:
// Setup your authentication values here
var username = "(Your user name)";
var password = "(Your password)";
// Add your variables to the submit form
loginForm.loginname.value = username;
loginForm.password.value = hex_md5(password.toLowerCase());
loginForm.encPassword.value = 'Y'
// submit the form
loginForm.submit();
That will bypass the form that is displayed to the user all together.
Hope that helps.
Upvotes: 1