File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,12 @@ public function setupTwoFactorAuthentication(Request $request)
3535 );
3636
3737 $ barcode = $ totp ->getQrCodeUri ();
38+
39+ // Return Barcode image if ajax Request
40+ if ($ request ->ajax ())
41+ {
42+ return $ barcode ;
43+ }
3844 return view ('2fa::setup ' , compact ('barcode ' , 'user ' ));
3945 }
4046
@@ -51,6 +57,14 @@ public function enableTwoFactorAuthentication(Request $request)
5157 $ user ->is_two_factor_enabled = 1 ;
5258 $ user ->update ();
5359
60+ if ($ request -ajax ()) {
61+ return [
62+ 'data ' => [
63+ 'message ' => 'success ' ,
64+ 'description ' => '2FA Enabled '
65+ ]
66+ ];
67+ }
5468 return redirect ('home ' );
5569 }
5670
@@ -68,6 +82,14 @@ public function disableTwoFactorAuthentication(Request $request)
6882 $ user ->two_factor_secret_key = null ;
6983 $ user ->update ();
7084
85+ if ($ request -ajax ()) {
86+ return [
87+ 'data ' => [
88+ 'message ' => 'success ' ,
89+ 'description ' => '2FA Disabled '
90+ ]
91+ ];
92+ }
7193 return redirect ('home ' );
7294 }
7395
You can’t perform that action at this time.
0 commit comments