Automatically login based on whitelisted IP, basic auth username or URL keys
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
resources/img Readme Nov 3, 2017
src Update plugin description Nov 4, 2017
CHANGELOG.md Initial Nov 3, 2017
LICENSE.md Initial Nov 3, 2017
README.md Update plugin description Nov 4, 2017
composer.json Fixed craftcms/cms requirement Dec 13, 2017

README.md

Autologin plugin for Craft CMS 3.x

Automatically login based on whitelisted IP, basic auth username or URL keys

Screenshot

Requirements

This plugin requires Craft CMS 3.0.0-beta.23 or later.

Installation

To install the plugin, follow these instructions.

  1. Open your terminal and go to your Craft project:

     cd /path/to/project
    
  2. Then tell Composer to load the plugin:

     composer require superbig/craft3-autologin
    
  3. In the Control Panel, go to Settings → Plugins and click the “Install” button for Autologin.

Configuring Autologin

<?php
return [
    // Enable the Autologin plugin
    'enabled'           => true,

    // A list of Craft usernames/emails mapped to IPs
    'ipWhitelist'       => [
        'craftUsername' => [
            '162.247.141.58',
            '162.247.141.59',
        ],
    ],

    // A list of Craft usernames/emails mapped to basic auth usernames
    'basicAuth'         => [
        'craftUserName1' => 'basicAuthUsername',
        'craftUserName2' => 'basicAuthUsername2',    
    ],
    
    // A list of Craft usernames/emails mapped to url keys
    'urlKeys'           => [
        'craftUserName' => 'BepmD8GQBZpaFpXQ',
    ],

    // Redirect to this url after logging in automatically
    'redirectUrl'       => '',
];

Login by URL

You can provide your users with a url that automatically logs them in. To set this up, you need a pair of username => password in the urlKeys setting.

After setting that up, you can login by going to siteurl.tld/autologin?key=BepmD8GQBZpaFpXQ.

If you want to redirect to the control panel dashboard, add cp=true to the url: siteurl.tld/autologin?key=BepmD8GQBZpaFpXQ&cp=true

Credits

Icon: Login icon by Gregor Cresnar

Brought to you by Superbig