Drupal auto login

Drupal auto login

I have lots of different Drupal sites I have to log in to on a regular basis and remembering what password I am using at any given time is impossible, my Chrome often gets my passwords wrong as well so to make my life easier I have written a tampermonkey script to log me in to my Drupal sites automatically. 

I also generally use a batch file if I have to open many sites at the same time so I have included that here as well, typing my password out 17 times becomes very tedious! 

Batch file for opening multiple incognito chrome tabs 

FOR %%A IN (
) DO start chrome.exe --incognito %%A

The Tampermonkey script for automatically logging you in to your Drupal sites  


// ==UserScript==
// @name            Drupal login.
// @namespace    http://drupal.log.in/
// @version          0.1
// @description     Loggs you in to your drupal site if you're on the user page 
// @copyright       2014+, Tom Gould
// @require          https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js
// @grant            GM_addStyle
// ==/UserScript==
var your_drupal_login = function() {
  var hostname = window.location.hostname.toLowerCase().replace('www.', '');
  var pathname = window.location.pathname.toLowerCase();
   * Sites to log in to
  var drupalSites = {
    tomgould: {
      host: "tom-gould.co.uk",
      user: "Username",
      pass: "password"
    TheWhiteHouse: {
      host: "petitions.whitehouse.gov",
      user: "Barack.Obama",
      pass: "Passw0rd123"
  if (pathname === "/user") {
    for (var key in drupalSites) {
      var site = drupalSites[key];
      if (site.host === hostname && $('input[name="name"]').length) {
        var r = confirm("Do you want to log in as " + site.user + " using password " + site.pass + "?");
        if (r === true) {


Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.