Download the PHP package creode/magic-login without Composer

On this page you can find all versions of the php package creode/magic-login. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package magic-login

Magic Login plugin for Craft CMS 3.x

A Magic Link plugin which sits on top of the existing user sign in and registration process.

Versions

For details about which version of this package to use with your version of Craft CMS please see the table below:

Craft Version Magic Login Version
<4.0.0 2.x
4.0.0 3.x
5.0.0 4.x

Requirements

This plugin requires Craft CMS Pro 3.5.0 or later in order to take advantage of the Template Roots feature.

Also due to the User based functionality of this plugin, we require a Craft Pro License to be installed.

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 creode/magic-login
  3. In the Control Panel, go to Settings → Plugins and click the “Install” button for Magic Login.

Magic Login Overview

The Magic Login plugin is a simple plugin that sits on top of the existing user login journey. The plugin provides a way for users to register and login using a unqiue one time url that is sent out to the provided email address, to verify the identity of a user.

The main aim of this plugin is to add simple, extendible functionality utilising as much of the existing login and registration journey as possible. The plugin was built with customisation in mind, allowing all frontend templates to be customised to the users liking. For those people who just want this functioning, simple styled templates have been provided as default to get you up and running fast.

Configuring Magic Login

The Magic Login plugin comes with a few different configuration options as standard with more on the way as the plugin continues to mature. These are the following:

You can manage these from within the Control Panel or by copying the config file to magic-link.php within the project config folder.

Using Magic Login

Documented in the sections below are tips on using the magic login plugin within your existing project. This covers overwriting their templates, the list of routes provided by this plugin, using the existing stylesheets with your overwritten templates and how to include existing templates as partials in your project.

Registration

As of Version 2.0 the user registration functionality for Magic Logins will no longer throw an error if the user already exists. Instead it will send the link off the user and log them in if a Craft account is present for them.

For security reasons we don't want to make it apparent that an email has already registered on the website so as a fallback we will always show the link has been sent text. Perhaps in future we can add extra configuration settings to the plugin to allow these messages to be displayed back to the user.

Overwriting magic login templates

All of the templates on this plugin are overwritable using the Template Roots feature of Craft. The templates you can overwrite are listed below:

If you follow that folder structure inside your sites /templates file any of the above templates can be completely re-written in order to be configured or styled however you would like.

Plugin Routes

A few routes are defined as part of this plugin:

Whilst we have the following routes this plugin aims to also implement functionality on top of the existing user registration routes so a number of the form submission places are the same as if you were trying to register a user normally.

Include Asset Bundle

As part of this plugin we use asset bundles for styling the default templates. If you are overriding these templates but plan on including our existing styling you can do so by adding the following asset bundle into your own templates.

{% do view.registerAssetBundle("creode\\magiclogin\\assetbundles\\magiclogin\\MagicLoginAsset") %}

Include Template

We are also aware with this plugin that sometimes you may want to inject the existing templates into your own template code. Craft and twig comes with a way of doing this by adding the following to your template:

{% include 'magic-login/_login-form' %}

Technical Features / Under the Hood

Password Generation

In order to get the magic link functionality to work we have had to make a few assumptions of functionality under the hood. the biggest hurdle is that by default Craft requires a user to set a password when registering a new user. In order to keep this process as streamlined as possible we handle the generation of a random password behind the scenes. The length of this password can be configured for security but can go no lower than 16 characters. We see Magic Login as more of an addon and try not to make to many assumptions on how it should be used. We therefore also allow a user to be registered using a password of their choosing if required giving you the option to use it or not.

Magic Login User Group

In order to distinguish users which are allowed to use Magic Login functionality we create a new user group titled "Magic Login". This group was created so that we can target users using it with updates in the future in required. Another route we could have taken would be to assign a permission to a user but this felt a little too loose but maybe this is an option for the future.

User activation

In order to let this plugins user journey work as smoothly as possible, we tweak the user activation journey provided by Craft CMS. When a user registers using the Magic Login user journey, we cancel any user activation emails sent out. This is because at the end of this process we will send out a magic login link anyway prior to logging the user in, therefore an account will instead be activated instead once the Magic Login link has been clicked.

For now this suited the needs of the project this plugin was built for however if required we can always have an extra checkbox in the admin area to turn this functionality on and off.

This change is only applied when following the Magic Login Registration route however and all other functionality that depends on the standard Craft actionUserSave functionality will remain in tact.

Running Magic Login Test Suite

From the root of this plugin ensure to install the dependencies using composer:

composer install

From there you can access the codecept executable with the following:

php vendor/bin/codecept run

Magic Login Roadmap

Some things to do, and ideas for potential features:

Brought to you by Creode


All versions of magic-login with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
craftcms/cms Version ^5.0
paragonie/random-lib Version ^2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package creode/magic-login contains the following files

Loading the files please wait ....