Looking to hire Laravel developers? Try LaraJobs

laravel-magic-login maintained by pownall

Description
Passwordless login for Laravel. Allows users to login via a magic link.
Author
Last update
2020/12/02 22:12 (dev-master)
License
Downloads
3

Comments
comments powered by Disqus

Laravel Magic Laravel

Latest Version on Packagist GitHub Workflow Status Total Downloads

Allows you to create a temporary signed route that logs a user in. There is no config file, you define everything when generating the url.

I see the general usage being

User requests login -> You generate link and send in email -> User clicks link and is signed in.

Installation

You can install the package via composer:

composer require pownall/magic-login

Available Methods

  • redirectToUrl(string $url) - Default is /.
  • expiresAt(CarbonInterface $pointInTime) - Default is 1 hour after generating link.

Usage

Simple usage is:

MagicLogin::forUser($user)->generate();

If you want to alter the redirect url:

MagicLogin::forUser($user)
    ->redirectToUrl('/somewhere-else')
    ->generate();

or

MagicLogin::forUser($user)
    ->redirectToUrl(route('admin.dashboard'))
    ->generate();

If you want to make the link expire earlier or later pass a CarbonInterface to the expireAt method.

MagicLogin::forUser($user)
    ->expireAt(Carbon::now()->addMinutes(30))
    ->generate();

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email pownall@hey.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.