4

I'm trying to make an auto-login using Greasemonkey.
Can anyone help me?

Relevant HTML source:

<div id="login-main">
  <div id="login-container">
    <div id="login-left">
      <div id="welcome">Welcome</div>
      <form id="login-form" action="auth/login" method="post">
        <div>
          <label for="rememberme">Remember me</label>
          <input type="checkbox" class="remember" checked="checked" name="remember me"/>

          <label for="email" id="email-label" class="no-js">Email</label>
          <input id="email-email" type="text" name="handle" value="" autocomplete="off"/>

          <label for="combination" id="combo-label" class="no-js">Combination</label>
          <input id="password-clear" type="text" value="Combination" autocomplete="off"/>

          <input id="password-password" type="password" name="password" value="" autocomplete="off"/>
          <input id="sumbitLogin" class="signin" type="submit" value="Sign In"/>
        </div>
      </form>
Brock Adams
  • 90,639
  • 22
  • 233
  • 295
Bruno 'Shady'
  • 4,348
  • 13
  • 55
  • 73

1 Answers1

8
var f = document.getElementById("login-form");
f.elements.namedItem("email-email").value = "email@email";
f.elements.namedItem("password-password").value = "password";
f.submit();
w35l3y
  • 8,613
  • 3
  • 39
  • 51
  • Is there some way to protect the password, in case someone gets hold of the script? – anaik Jan 20 '16 at 08:33
  • No, the ONLY protection you have is prevent from installing unknown scripts. – w35l3y Feb 02 '16 at 00:45
  • I meant, in a script that I write, could anyone suggest some way to encrypt the password somehow so that anyone reading the script cannot directly know my password? – anaik Feb 03 '16 at 10:42
  • 2
    @abhisheknaik96, see [Storing user input in a Greasemonkey script on install](http://stackoverflow.com/questions/15268645/storing-user-input-in-a-greasemonkey-script-on-install). – Brock Adams Feb 25 '16 at 17:01