@@ -87,15 +87,15 @@ discard block |
||
87 | 87 | */ |
88 | 88 | public function __construct(helper $controller_helper, driver_interface $db, template $template, user $user, request_interface $request, config $config, session_helper_interface $session_helper, $root_path, $php_ext) |
89 | 89 | { |
90 | - $this->controller_helper = $controller_helper; |
|
91 | - $this->template = $template; |
|
92 | - $this->db = $db; |
|
93 | - $this->user = $user; |
|
94 | - $this->request = $request; |
|
95 | - $this->config = $config; |
|
96 | - $this->session_helper = $session_helper; |
|
97 | - $this->root_path = $root_path; |
|
98 | - $this->php_ext = $php_ext; |
|
90 | + $this->controller_helper = $controller_helper; |
|
91 | + $this->template = $template; |
|
92 | + $this->db = $db; |
|
93 | + $this->user = $user; |
|
94 | + $this->request = $request; |
|
95 | + $this->config = $config; |
|
96 | + $this->session_helper = $session_helper; |
|
97 | + $this->root_path = $root_path; |
|
98 | + $this->php_ext = $php_ext; |
|
99 | 99 | |
100 | 100 | } |
101 | 101 | |
@@ -225,8 +225,8 @@ discard block |
||
225 | 225 | if ($admin) |
226 | 226 | { |
227 | 227 | // the login array is used because the user ids do not differ for re-authentication |
228 | - $sql = 'DELETE FROM ' . SESSIONS_TABLE . " |
|
229 | - WHERE session_id = '" . $this->db->sql_escape($old_session_id) . "' |
|
228 | + $sql = 'DELETE FROM '.SESSIONS_TABLE." |
|
229 | + WHERE session_id = '" . $this->db->sql_escape($old_session_id)."' |
|
230 | 230 | AND session_user_id = " . (int) $user_id; |
231 | 231 | $this->db->sql_query($sql); |
232 | 232 |
@@ -147,8 +147,7 @@ discard block |
||
147 | 147 | if (!empty($secure)) |
148 | 148 | { |
149 | 149 | return 'on' == strtolower($secure) || '1' == $secure; |
150 | - } |
|
151 | - else if ('443' == $this->request->server('SERVER_PORT')) |
|
150 | + } else if ('443' == $this->request->server('SERVER_PORT')) |
|
152 | 151 | { |
153 | 152 | return true; |
154 | 153 | } |
@@ -236,10 +235,12 @@ discard block |
||
236 | 235 | |
237 | 236 | if (property_exists($response, 'errorCode')) |
238 | 237 | { |
239 | - if ($response->errorCode == 4) // errorCode 4 means that this device wasn't registered |
|
238 | + if ($response->errorCode == 4) { |
|
239 | + // errorCode 4 means that this device wasn't registered |
|
240 | 240 | { |
241 | 241 | throw new AccessDeniedHttpException($this->user->lang('TFA_NOT_REGISTERED')); |
242 | 242 | } |
243 | + } |
|
243 | 244 | throw new BadRequestHttpException($this->user->lang('TFA_SOMETHING_WENT_WRONG')); |
244 | 245 | } |
245 | 246 | $result = new AuthenticationResponse($response->signatureData, $response->clientData, $response->keyHandle, $response->errorCode); |
@@ -253,12 +254,10 @@ discard block |
||
253 | 254 | |
254 | 255 | $sql = 'UPDATE ' . $this->registration_table . ' SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' WHERE registration_id = ' . (int) $reg->getId(); |
255 | 256 | $this->db->sql_query($sql); |
256 | - } |
|
257 | - catch (U2fError $error) |
|
257 | + } catch (U2fError $error) |
|
258 | 258 | { |
259 | 259 | $this->createError($error); |
260 | - } |
|
261 | - catch (\InvalidArgumentException $invalid) |
|
260 | + } catch (\InvalidArgumentException $invalid) |
|
262 | 261 | { |
263 | 262 | throw new BadRequestHttpException($this->user->lang('TFA_SOMETHING_WENT_WRONG') . '<br />' . $invalid->getMessage(), $invalid); |
264 | 263 | } |
@@ -295,8 +294,7 @@ discard block |
||
295 | 294 | if ($count == 0) |
296 | 295 | { |
297 | 296 | trigger_error('TFA_UNABLE_TO_UPDATE_SESSION'); |
298 | - } |
|
299 | - else if ($count > 1) |
|
297 | + } else if ($count > 1) |
|
300 | 298 | { |
301 | 299 | // Reset sessions table. We had multiple sessions with same ID!!! |
302 | 300 | $sql_ary['u2f_request'] = ''; |
@@ -340,8 +338,7 @@ discard block |
||
340 | 338 | ); |
341 | 339 | |
342 | 340 | $this->update_session($sql_ary); |
343 | - } |
|
344 | - catch (U2fError $err) |
|
341 | + } catch (U2fError $err) |
|
345 | 342 | { |
346 | 343 | $this->createError($err); |
347 | 344 | } |
@@ -72,11 +72,11 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function __construct(driver_interface $db, config $config, user $user, service_collection $modules, $registration_table, $user_table) |
74 | 74 | { |
75 | - $this->db = $db; |
|
76 | - $this->user = $user; |
|
77 | - $this->config = $config; |
|
78 | - $this->registration_table = $registration_table; |
|
79 | - $this->user_table = $user_table; |
|
75 | + $this->db = $db; |
|
76 | + $this->user = $user; |
|
77 | + $this->config = $config; |
|
78 | + $this->registration_table = $registration_table; |
|
79 | + $this->user_table = $user_table; |
|
80 | 80 | |
81 | 81 | $this->validateModules($modules); |
82 | 82 | } |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | { |
203 | 203 | if (empty($userdata)) |
204 | 204 | { |
205 | - $sql = 'SELECT * FROM ' . $this->user_table . 'WHERE user_id = ' . (int) $user_id; |
|
205 | + $sql = 'SELECT * FROM '.$this->user_table.'WHERE user_id = '.(int) $user_id; |
|
206 | 206 | $result = $this->db->sql_query($sql); |
207 | 207 | $userdata = $this->db->sql_fetchrow($result); |
208 | 208 | $this->db->sql_freeresult($result); |