File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed
Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 2424 */
2525 'account_name ' => 'Thecodework 2FA ' ,
2626
27+ /*
28+ * Set Gurad for 2FA
29+ * By defauly the `web` gurad will be used but you
30+ * can define any custom gurad to utilize 2FA.
31+ */
32+ 'guard ' => 'web ' ,
33+
2734 /*
2835 * Currntly Support 'Sha1'
2936 * The library works with the Google Authenticator application
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ public function __construct()
3030 $ this ->TwoFAModel = TwoFactorAuthenticationServiceProvider::getTwoFAModelInstance ();
3131
3232 $ this ->middleware (function ($ request , $ next ) {
33- $ this ->setUser (auth ( )->user ());
33+ $ this ->setUser (\Auth:: guard ( config ( ' 2fa-config.guard ' ) )->user ());
3434
3535 return $ next ($ request );
3636 });
@@ -143,7 +143,6 @@ public function verifyTwoFactorAuthentication(Request $request)
143143 * Encode Random String to 32 Base Transfer Encoding.
144144 *
145145 * @param int $length Length of the encoded string.
146- *
147146 * @return string
148147 */
149148 private function base32EncodedString ($ length = 30 ):
@@ -156,7 +155,6 @@ private function base32EncodedString($length = 30):
156155 * Generate a more truly "random" alpha-numeric string.
157156 *
158157 * @param int $length
159- *
160158 * @return string
161159 */
162160 private function strRandom ($ length = 30 ):
@@ -175,6 +173,11 @@ private function strRandom($length = 30):
175173 return $ string ;
176174 }
177175
176+ /**
177+ * Update User data with 2FA generated Key
178+ *
179+ * @return void
180+ */
178181 private function updateUserWith2FAGeneratedKey ()
179182 {
180183 $ user = $ this ->TwoFAModel ->find ($ this ->getUser ()->id );
You can’t perform that action at this time.
0 commit comments