Installs: 41

Dependents: 0

Suggesters: 0

Stars: 14

Watchers: 4

Forks: 4


3.0.0-alpha.2 2019-05-11 05:11 UTC


Seamless legacy authentication for CraftCMS

by Michael Rog


The Legacy Login plugin provides a way to authenticate users from a legacy system into your Craft CMS site.

The plugin replaces the normal login form action. If a submitted loginName/password fails Craft's native authentication (i.e. the legacy user doesn't yet exist in the new Craft site), the plugin checks the legacy system(s) and tries to authenticate a user from there. If a matching legacy user is found and authenticated, the plugin imports the User into Craft and logs into the newly created account.

What legacy systems are supported?

Drivers are provided for authenticating legacy users from:

  • Craft CMS 3.x
  • Craft CMS 2.x
  • ExpressionEngine 2.x
  • WordPress
  • BigCommerce (Self-hosted)
  • Wellspring


First, copy the legacylogin folder into your Craft plugins directory.

Then, navitage to the Settings > Plugins area of the control panel, and Install the plugin.

The plugin creates a data table for each supported legacy system (i.e. craft_legacylogin_data_ee2 for storing ExpressionEngine member data).

Import your legacy user data into the appropriate title. The schema should more-or-less match up; Some fields may be mismatched/skipped based on the version of the legacy system you're using, but the key fields (the username, id, email, and password hash) will be covered.

Finally, add the Legacy Login form to your login template. The template follows the same design as Craft's native login form, except the form action should point to the LegacyLoginController rather than Craft's native UsersController:

<form method="post" accept-charset="UTF-8">

	{{ getCsrfInput() }}
	<input type="hidden" name="action" value="legacy-login/login">

	<label for="loginName">Username or email</label>
	<input id="loginName" type="text" name="loginName" value="{{ craft.session.rememberedUsername }}">

	<label for="password">Password</label>
	<input id="password" type="password" name="password">

		<input type="checkbox" name="rememberMe" value="1">
		Remember me

	<input type="submit" value="Login">

	{% if errorMessage is defined %}
		<p>{{ errorMessage }}</p>
	{% endif %}


To customize the plugin's behavior, add a legacylogin.php file to your Craft config directory. (You can use plugins/legacylogin/config.php as a template.) The file should return an array; Like Craft's own General Configs, the Legacy Login config supports Craft's Multi-Environment Configs syntax.

The following settings are available:


An array defining the legacy authentication handlers.

Each handler takes the following options:


'Craft3', 'Craft2', 'EE2', 'BigCommerce', 'Wellspring', 'WordPress', or a custom (fully qualified) class name.

Default: 'Craft3'


A boolean which determines whether to create a new Craft user if a matching one doesn't already exist in the system. (If false, only current Users can be logged in via legacy handlers. Authentication for legacy users that don't match a User in the current system will fail whether the loginName/password are correct or not.)

Default: true


A boolean which determines whether to set the password of a matched/created Craft user to match the legacy password.

Default: true


A boolean which determines whether to set the Require Password Reset flag on a matched/created Craft user, i.e. requiring them to change their password upon their next login.

Default: false

What are the system requirements?

Craft 3.0+ and PHP 7.1+

I found a bug.

I'm not surprised... Legacy Login is still in development. Please open a GitHub Issue, submit a PR, or just email me to let me know.


  • Plugin development: Michael Rog / @michaelrog
  • Craft 2 plugin - WordPress and Wellspring drivers: Aaron Waldon / @aaronwaldon
  • Craft 3 plugin - initial port: TJ Draper / @buzzingpixel