1 | <?php |
||
12 | class Authenticator extends Google2FA |
||
13 | { |
||
14 | use ErrorBag, Input, Response, Session; |
||
15 | |||
16 | /** |
||
17 | * The current password. |
||
18 | * |
||
19 | * @var |
||
20 | */ |
||
21 | protected $password; |
||
22 | |||
23 | /** |
||
24 | * Authenticator constructor. |
||
25 | * |
||
26 | * @param \Illuminate\Http\Request $request |
||
27 | */ |
||
28 | 9 | public function __construct(IlluminateRequest $request) |
|
32 | |||
33 | /** |
||
34 | * Authenticator boot. |
||
35 | * |
||
36 | * @param $request |
||
37 | * |
||
38 | * @return Google2FA |
||
39 | */ |
||
40 | 9 | public function boot($request) |
|
46 | |||
47 | /** |
||
48 | * Authenticator boot for API usage. |
||
49 | * |
||
50 | * @param $request |
||
51 | * |
||
52 | * @return Google2FA |
||
53 | */ |
||
54 | 1 | public function bootStateless($request) |
|
62 | |||
63 | /** |
||
64 | * Fire login (success or failed). |
||
65 | * |
||
66 | * @param $succeeded |
||
67 | */ |
||
68 | 4 | private function fireLoginEvent($succeeded) |
|
78 | |||
79 | /** |
||
80 | * Get the OTP from user input. |
||
81 | * |
||
82 | * @throws InvalidOneTimePassword |
||
83 | * |
||
84 | * @return mixed |
||
85 | */ |
||
86 | 5 | protected function getOneTimePassword() |
|
99 | |||
100 | /** |
||
101 | * Check if the current use is authenticated via OTP. |
||
102 | * |
||
103 | * @return bool |
||
104 | */ |
||
105 | 9 | public function isAuthenticated() |
|
109 | |||
110 | /** |
||
111 | * Check if it is already logged in or passable without checking for an OTP. |
||
112 | * |
||
113 | * @return bool |
||
114 | */ |
||
115 | 9 | protected function canPassWithoutCheckingOTP() |
|
123 | |||
124 | /** |
||
125 | * Check if the input OTP is valid. Returns one of the possible OTP_STATUS codes: |
||
126 | * 'empty', 'valid' or 'invalid'. |
||
127 | * |
||
128 | * @return string |
||
129 | */ |
||
130 | 9 | protected function checkOTP() |
|
146 | |||
147 | /** |
||
148 | * Verify the OTP. |
||
149 | * |
||
150 | * @throws InvalidOneTimePassword |
||
151 | * |
||
152 | * @return mixed |
||
153 | */ |
||
154 | 5 | protected function verifyOneTimePassword() |
|
158 | } |
||
159 |