1 | <?php |
||
18 | class Google2FA extends Google2FAService |
||
19 | { |
||
20 | use Auth, Config, Request, Session; |
||
21 | |||
22 | protected $qrCodeBackend; |
||
23 | |||
24 | /** |
||
25 | * Construct the correct backend. |
||
26 | */ |
||
27 | 15 | protected function constructBackend(): void |
|
44 | |||
45 | /** |
||
46 | * Set the QRCode Backend. |
||
47 | * |
||
48 | * @param string $qrCodeBackend |
||
49 | * @return self |
||
50 | */ |
||
51 | 1 | public function setQrCodeBackend(string $qrCodeBackend) |
|
57 | |||
58 | /** |
||
59 | * Authenticator constructor. |
||
60 | * |
||
61 | * @param IlluminateRequest $request |
||
62 | */ |
||
63 | 15 | public function __construct(IlluminateRequest $request) |
|
69 | |||
70 | /** |
||
71 | * Authenticator boot. |
||
72 | * |
||
73 | * @param $request |
||
74 | * |
||
75 | * @return Google2FA |
||
76 | */ |
||
77 | 15 | public function boot($request) |
|
83 | |||
84 | /** |
||
85 | * The QRCode Backend. |
||
86 | * |
||
87 | * @return mixed |
||
88 | */ |
||
89 | 15 | public function getQRCodeBackend() |
|
94 | |||
95 | /** |
||
96 | * Get the user Google2FA secret. |
||
97 | * |
||
98 | * @throws InvalidSecretKey |
||
99 | * |
||
100 | * @return mixed |
||
101 | */ |
||
102 | 10 | protected function getGoogle2FASecretKey() |
|
106 | |||
107 | /** |
||
108 | * Check if the 2FA is activated for the user. |
||
109 | * |
||
110 | * @return bool |
||
111 | */ |
||
112 | 10 | public function isActivated() |
|
118 | |||
119 | /** |
||
120 | * Store the old OTP timestamp. |
||
121 | * |
||
122 | * @param $key |
||
123 | * |
||
124 | * @return mixed |
||
125 | */ |
||
126 | 5 | protected function storeOldTimestamp($key) |
|
132 | |||
133 | /** |
||
134 | * Get the previous OTP timestamp. |
||
135 | * |
||
136 | * @return null|mixed |
||
137 | */ |
||
138 | 6 | protected function getOldTimestamp() |
|
144 | |||
145 | /** |
||
146 | * Keep this OTP session alive. |
||
147 | */ |
||
148 | 4 | protected function keepAlive() |
|
154 | |||
155 | /** |
||
156 | * Get minutes since last activity. |
||
157 | * |
||
158 | * @return int |
||
159 | */ |
||
160 | 1 | protected function minutesSinceLastActivity() |
|
166 | |||
167 | /** |
||
168 | * Check if no user is authenticated using OTP. |
||
169 | * |
||
170 | * @return bool |
||
171 | */ |
||
172 | 9 | protected function noUserIsAuthenticated() |
|
176 | |||
177 | /** |
||
178 | * Check if OTP has expired. |
||
179 | * |
||
180 | * @return bool |
||
181 | */ |
||
182 | 4 | protected function passwordExpired() |
|
196 | |||
197 | /** |
||
198 | * Verifies, in the current session, if a 2fa check has already passed. |
||
199 | * |
||
200 | * @return bool |
||
201 | */ |
||
202 | 9 | protected function twoFactorAuthStillValid() |
|
208 | |||
209 | /** |
||
210 | * Check if the module is enabled. |
||
211 | * |
||
212 | * @return mixed |
||
213 | */ |
||
214 | 9 | protected function isEnabled() |
|
218 | |||
219 | /** |
||
220 | * Set current auth as valid. |
||
221 | */ |
||
222 | 5 | public function login() |
|
228 | |||
229 | /** |
||
230 | * OTP logout. |
||
231 | */ |
||
232 | 3 | public function logout() |
|
240 | |||
241 | /** |
||
242 | * Update the current auth time. |
||
243 | */ |
||
244 | 5 | protected function updateCurrentAuthTime() |
|
248 | |||
249 | /** |
||
250 | * Verify the OTP. |
||
251 | * |
||
252 | * @param $secret |
||
253 | * @param $one_time_password |
||
254 | * |
||
255 | * @return mixed |
||
256 | */ |
||
257 | 6 | public function verifyGoogle2FA($secret, $one_time_password) |
|
267 | |||
268 | /** |
||
269 | * Verify the OTP and store the timestamp. |
||
270 | * |
||
271 | * @param $one_time_password |
||
272 | * |
||
273 | * @return mixed |
||
274 | */ |
||
275 | 5 | protected function verifyAndStoreOneTimePassword($one_time_password) |
|
284 | } |
||
285 |
This check looks for a call to a parent method whose name is different than the method from which it is called.
Consider the following code:
The
getFirstName()
method in theSon
calls the wrong method in the parent class.