Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel One Time Passwords Laravel Package

spatie/laravel-one-time-passwords

Generate and verify secure one-time passwords (6‑digit by default) in Laravel. Sends OTPs via mail notifications (extendable to SMS/other channels) and includes a Livewire login component. Optional Flux support provides an enhanced OTP input UI.

View on GitHub
Deep Wiki
Context7

title: Enforcing origin weight: 2

By default, the package will only accept a one-time password if the request is coming from the same origin as the page that generated it.

The origin is determined by looking at the IP address of the request and the user agent. This is implemented in the Spatie\OneTimePasswords\Support\OriginInspector\DefaultOriginEnforcer class.

Customizing the origin enforcement

You can override this behavior by implementing your own OriginEnforcer class. This class should implement the Spatie\OneTimePasswords\Support\OriginInspector\OriginEnforcer interface.

This is how that interface looks like:

use Illuminate\Http\Request;
use Spatie\OneTimePasswords\Models\OneTimePassword;

interface OriginEnforcer
{
    /** [@return](https://github.com/return) array<string, string|int> */
    public function gatherProperties(Request $request): array;

    public function verifyProperties(OneTimePassword $oneTimePassword, Request $request): bool;
}

The gatherProperties method should return an array of properties that will be used to identify the origin of the request. The verifyProperties method should return true if the properties match, and false otherwise.

To see an example, take a look at the Spatie\OneTimePasswords\Support\OriginInspector\DefaultOriginEnforcer class in the package's source code.

Disabling the origin enforcement

If you want to disable the origin enforcement, you can do so by setting the origin_enforcer config option to Spatie\OneTimePasswords\Support\OriginInspector\DoNotEnforceOrigin in the one-time-passwords.php file:

// config/one-time-passwords.php

return [
    // ...

    'origin_enforcer' => Spatie\OneTimePasswords\Support\OriginInspector\DoNotEnforceOrigin::class,
];
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope
anil/file-picker
broqit/fields-ai