c6digital/filament-passwordless-login

Simple passwordless login for Filament.

v0.3.0 2024-03-20 15:11 UTC

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This package provides a new Login component that replaces the traditional email and password form with a simple passwordless login form.

Installation

You can install the package via composer:

composer require c6digital/filament-passwordless-login

Optionally, you can publish the views using

php artisan vendor:publish --tag="filament-passwordless-login-views"

Usage

Register the plugin on your Filament panel.

use C6Digital\PasswordlessLogin\PasswordlessLoginPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->//...
        ->plugin(PasswordlessLoginPlugin::make());
}

This will automatically register the new login page, overwriting the one provided by Filament. It also registers the necessary routes to authenticate users using a magic login link.

Using password in local environments

Sending login links emails during development can be difficult. If you are still storing passwords for your users, you can enable password authentication in local environments.

PasswordlessLoginPlugin::make()
    ->allowPasswordInLocalEnvironment()

Now a "Password" field will be displayed on the Login page when APP_ENV=local.

Action

This package also provides an Action that can be used inside of Filament tables.

use C6Digital\PasswordlessLogin\Actions\LoginLinkAction;

$table
    ->actions([
        LoginLinkAction::make(),
    ]);

Command

If you need to generate a login link without accessing the site, you can use the passwordless:link command.

php artisan passwordless:link {email}

Testing

composer test

Changelog

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

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

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