1 | <?php |
||
12 | class Authenticator extends Google2FA |
||
13 | { |
||
14 | use ErrorBag; |
||
15 | use Input; |
||
16 | use Response; |
||
17 | use Session; |
||
18 | /** |
||
19 | * The current password. |
||
20 | * |
||
21 | * @var |
||
22 | */ |
||
23 | protected $password; |
||
24 | |||
25 | /** |
||
26 | * Authenticator constructor. |
||
27 | * |
||
28 | * @param \Illuminate\Http\Request $request |
||
29 | */ |
||
30 | 9 | public function __construct(IlluminateRequest $request) |
|
34 | |||
35 | /** |
||
36 | * Authenticator boot. |
||
37 | * |
||
38 | * @param $request |
||
39 | * |
||
40 | * @return Google2FA |
||
41 | */ |
||
42 | 9 | public function boot($request) |
|
48 | |||
49 | /** |
||
50 | * Authenticator boot for API usage. |
||
51 | * |
||
52 | * @param $request |
||
53 | * |
||
54 | * @return Google2FA |
||
55 | */ |
||
56 | 1 | public function bootStateless($request) |
|
64 | |||
65 | /** |
||
66 | * Fire login (success or failed). |
||
67 | * |
||
68 | * @param $succeeded |
||
69 | */ |
||
70 | 5 | private function fireLoginEvent($succeeded) |
|
80 | |||
81 | /** |
||
82 | * Get the OTP from user input. |
||
83 | * |
||
84 | * @throws InvalidOneTimePassword |
||
85 | * |
||
86 | * @return mixed |
||
87 | */ |
||
88 | 5 | protected function getOneTimePassword() |
|
102 | |||
103 | /** |
||
104 | * Check if the current use is authenticated via OTP. |
||
105 | * |
||
106 | * @return bool |
||
107 | */ |
||
108 | 9 | public function isAuthenticated() |
|
112 | |||
113 | /** |
||
114 | * Check if it is already logged in or passable without checking for an OTP. |
||
115 | * |
||
116 | * @return bool |
||
117 | */ |
||
118 | 9 | protected function canPassWithoutCheckingOTP() |
|
126 | |||
127 | /** |
||
128 | * Check if the input OTP is valid. Returns one of the possible OTP_STATUS codes: |
||
129 | * 'empty', 'valid' or 'invalid'. |
||
130 | * |
||
131 | * @return string |
||
132 | */ |
||
133 | 9 | protected function checkOTP() |
|
152 | |||
153 | /** |
||
154 | * Verify the OTP. |
||
155 | * |
||
156 | * @throws InvalidOneTimePassword |
||
157 | * |
||
158 | * @return mixed |
||
159 | */ |
||
160 | 5 | protected function verifyOneTimePassword() |
|
164 | } |
||
165 |