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