You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: The current version of the package is beta release, so be careful before using it for production applications.
21
22
22
23
**2. Add Service Provider**
24
+
23
25
After requiring the package add `TwoFactorAuthenticationServiceProvider::class` into providors array in `app.php` confi file
24
26
25
27
```php
@@ -32,13 +34,15 @@ After requiring the package add `TwoFactorAuthenticationServiceProvider::class`
32
34
```
33
35
34
36
**3. Run Migrations**
37
+
35
38
Now run the migration
36
39
```bash
37
40
$ php artisan migrate
38
41
```
39
42
It will use the default User model and adds two columns `is_2fa_enabled` and `secret_key`.
40
43
41
44
**4. Add `AuthenticatesUserWith2FA` trait in the LoginController**
45
+
42
46
Now the config file is placed. The last thing to do is addding `AuthenticatesUsersWith2FA` trait in the `Http/Controllers/Auth/LoginController.php` file which helps to stop user at verify-2fa page to enter TOTP token after each login.
43
47
44
48
The final snippet will look like this.
@@ -50,6 +54,7 @@ use AuthenticatesUsers, AuthenticatesUsersWith2FA {
50
54
Note: Don't forget to include use statement `use Thecodework\TwoFactorAuthentication\AuthenticatesUsersWith2FA` in the header.
0 commit comments