5
5
[ ![ GitHub Code Style Action Status] ( https://img.shields.io/github/actions/workflow/status/chrysanthos/laravel-otp/fix-php-code-style-issues.yml?branch=main&label=code%20style )] ( https://github.com/chrysanthos/laravel-otp/actions?query=workflow%3A"Fix+PHP+code+style+issues"+branch%3Amain )
6
6
[ ![ Total Downloads] ( https://img.shields.io/packagist/dt/chrysanthos/laravel-otp.svg?style=flat-square )] ( https://packagist.org/packages/chrysanthos/laravel-otp )
7
7
8
- This package lets you set up OTP verification on whenever a user is logged in .
8
+ This package lets you set up an OTP verification process upon user login .
9
9
10
10
## Installation
11
11
@@ -21,15 +21,39 @@ You can publish the config file with:
21
21
php artisan vendor:publish --tag=" laravel-otp-config"
22
22
```
23
23
24
- This is the contents of the published config file:
24
+ There are the contents of the published config file:
25
25
26
26
``` php
27
27
return [
28
28
29
+ /**
30
+ * Whether the package will register the routes and listeners.
31
+ */
29
32
'enabled' => false,
30
33
34
+ /**
35
+ * The logo image to be shown above otp input.
36
+ */
37
+ 'logo' => null,
38
+
39
+ /**
40
+ * The notification to be sent to the logged-in user.
41
+ * Override this with your own implementation so that
42
+ * you can customize the channels, message format etc.
43
+ */
31
44
'notification' => \Chrysanthos\LaravelOtp\Notifications\SendOtpToUserNotification::class,
32
45
46
+ /**
47
+ * The paths that should be protected by otp. This must be
48
+ * relative paths with no slashes at the start of the string.
49
+ * Use this option in case you have admin login area with tools
50
+ * like Nova/Backpack/Filament and only nedd otp in the main site
51
+ *
52
+ * Sadly the paths must point to the uri path of the route that the login form is submitted to.
53
+ */
54
+ 'paths' => [
55
+ '*',
56
+ ],
33
57
];
34
58
```
35
59
@@ -44,6 +68,8 @@ php artisan vendor:publish --tag="laravel-otp-views"
44
68
Add the RedirectToOtpPage Middleware to the routes you wish to be protected by OTP.
45
69
46
70
``` php
71
+ use Chrysanthos\LaravelOtp\Middleware\RedirectToOtpPage;
72
+
47
73
Route::middleware([
48
74
'auth:sanctum',
49
75
RedirectToOtpPage::class,
@@ -52,7 +78,7 @@ Route::middleware([
52
78
});
53
79
```
54
80
55
- Customize the notification you wish to be sent by changing the notification key in the config.
81
+ You may customize the notification by changing the ` notification ` key in the config.
56
82
By setting the notification to a custom notification class you have full flexibility on how the notification is sent (Channels, Text, etc.)
57
83
58
84
``` php
0 commit comments