Download the PHP package webard/filament-otp-actions without Composer

On this page you can find all versions of the php package webard/filament-otp-actions. 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 filament-otp-actions

Filament OTP actions

Proof of concept. This package is not ready for production. It depends on Filament features that are not in a release yet, the API is still open to change, and it has no test suite of its own. Published so the approach can be tried and discussed.

Confirm Filament actions with a one-time code from the multi-factor authentication method that the user already set up on their panel.

What it does

The action's own modal comes first, whatever it is - a form, a confirmation, or both. Once the form validates and the confirmation is accepted, the action pauses and a code modal is stacked on top of it. The action resumes only after a valid code, with everything the user entered still intact.

An action with no modal of its own goes straight to the code modal.

Macros

Macro What it does
requiresOtpConfirmation(bool \| Closure $condition = true, bool \| string \| Closure \| null $cancelsOnClose = false) Pauses the action until a valid code is entered. The condition is evaluated after the schema is validated, so it can read $action->getData(). $cancelsOnClose decides what closing the code modal does.
disableWhenNoOtp() Disables the action when the user has no multi-factor method enabled.
hideWhenNoOtp() Hides it instead.

disableWhenNoOtp() and hideWhenNoOtp() compose with any disabled() / hidden() condition already on the action, rather than replacing it.

Challenge only large transfers:

Closing the code modal

By default, closing the code modal takes the user back to the action they came from, with everything they had entered still in place. They can correct the form and submit again.

Pass cancelsOnClose to abandon the action instead, which closes every modal and discards what was entered:

For a flow several modals deep, pass the name of an ancestor action to close back to that one rather than all of them:

It takes a Closure too, so the decision can depend on anything the action knows:

Whatever you pass, the code modal always abandons the action when the user has no authentication method set up - there is nothing to go back and correct.

Requirements

Multi-factor authentication has to be configured on the panel, and the user model has to implement the contracts of the providers you register:

Whichever methods the user has enabled are offered in the code modal, exactly as they are during login - including the picker when more than one is enabled, and app recovery codes.

How it works

The package uses two pieces of Filament core:

Both are pull requests against Filament. Until they are released, the package needs a build of Filament that contains them.

Where a confirmation lives

A confirmation is held in a request-scoped singleton, never in the action's arguments. The browser may call a paused action at any time - after closing the code modal, for example - so a confirmation must be something only the server can grant. Cancelling the code modal and calling the action again simply challenges again.

When the user has no method set up

An action that requires a code but is neither hidden nor disabled still cannot run. Instead of a challenge that nothing could answer, the modal explains why, and links to the profile page where the user sets a method up:

The link only appears when the panel has ->profile() enabled. Use disableWhenNoOtp() or hideWhenNoOtp() when you would rather the action not be offered at all.

Caveats


All versions of filament-otp-actions with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
filament/actions Version *
filament/filament Version *
filament/schemas Version *
filament/support Version *
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 webard/filament-otp-actions contains the following files

Loading the files please wait ...