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
Copy file name to clipboardExpand all lines: README.md
+27-37Lines changed: 27 additions & 37 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,52 +13,32 @@ This package lets you setup your two factor authentication for your existing lar
13
13
- Google Authenticator [Android](https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2&hl=en) - [iOS](https://itunes.apple.com/in/app/google-authenticator/id388497605?mt=8) or [Authy](https://www.authy.com/) mobile app
Once the config file is published you can navigate to config directory of your application and look for `2fa-config.php` file and change configuration as you want.
32
-
The config file will look like this and have following configurable option.
33
25
```php
34
-
/*
35
-
* Specify redirect url after when token authentication
36
-
* is successfull.
37
-
*/
38
-
'redirect_to' => '/home',
39
-
40
-
/*
41
-
* Account name which will be used as label to show on
42
-
* authenticator mobile application.
43
-
*/
44
-
'account_name' => 'Thecodework 2FA',
45
-
46
-
/*
47
-
* Currntly Support 'Sha1'
48
-
* The library works with the Google Authenticator application
49
-
* for iPhone and Android. Google only supports SHA-1 digest algorithm,
50
-
* 30 second period and 6 digits OTP. Other values for these parameters
51
-
* are ignored by the Google Authenticator application.
It will use the default User model and adds two columns `is_2fa_enabled` and `secret_key`.
61
40
41
+
**4. Add `AuthenticatesUserWith2FA` trait in the LoginController**
62
42
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.
63
43
64
44
The final snippet will look like this.
@@ -67,7 +47,17 @@ use AuthenticatesUsers, AuthenticatesUsersWith2FA {
Now login to the application and visit `setup-2fa` route, which will show a barcode which can be scanned either using Google Authenticator or Authy mobile application as described above.
50
+
Note: Don't forget to include use statement `use Thecodework\TwoFactorAuthentication\AuthenticatesUsersWith2FA` in the header.
Once the config file is published you can navigate to config directory of your application and look for `2fa-config.php` file and change configuration as you want.
58
+
**6. Setup 2FA for user**
59
+
60
+
Now login to the application and visit `/setup-2fa/` route, which will show a barcode which can be scanned either using Google Authenticator or Authy mobile application as described above.
71
61
Scan that code and click **Enable Two Factor Authentication**.
72
62
73
63
Now perform logout and log back in again, it will ask you to enter Token which can be obtain from the authenticator mobile application. Enter the token and you're logged in.
0 commit comments