| @@ 76-92 (lines=17) @@ | ||
| 73 | * |
|
| 74 | * @return mixed |
|
| 75 | */ |
|
| 76 | public function enableTwoFactorAuthentication(Request $request) |
|
| 77 | { |
|
| 78 | $user = $this->getUser(); |
|
| 79 | $user->is_two_factor_enabled = 1; |
|
| 80 | $user->update(); |
|
| 81 | ||
| 82 | if ($request->ajax()) { |
|
| 83 | return [ |
|
| 84 | 'data' => [ |
|
| 85 | 'message' => 'success', |
|
| 86 | 'description' => '2FA Enabled', |
|
| 87 | ], |
|
| 88 | ]; |
|
| 89 | } |
|
| 90 | ||
| 91 | return redirect('home'); |
|
| 92 | } |
|
| 93 | ||
| 94 | /** |
|
| 95 | * Enable 2FA. |
|
| @@ 101-118 (lines=18) @@ | ||
| 98 | * |
|
| 99 | * @return mixed |
|
| 100 | */ |
|
| 101 | public function disableTwoFactorAuthentication(Request $request) |
|
| 102 | { |
|
| 103 | $user = $this->getUser(); |
|
| 104 | $user->is_two_factor_enabled = 0; |
|
| 105 | $user->two_factor_secret_key = null; |
|
| 106 | $user->update(); |
|
| 107 | ||
| 108 | if ($request->ajax()) { |
|
| 109 | return [ |
|
| 110 | 'data' => [ |
|
| 111 | 'message' => 'success', |
|
| 112 | 'description' => '2FA Disabled', |
|
| 113 | ], |
|
| 114 | ]; |
|
| 115 | } |
|
| 116 | ||
| 117 | return redirect('home'); |
|
| 118 | } |
|
| 119 | ||
| 120 | /** |
|
| 121 | * Verify Two Factor Authentication. |
|