@@ -162,8 +162,7 @@ |
||
162 | 162 | // We simply return and continue the login procedure (The normal way :)), |
163 | 163 | // and will disable all pages untill he has added a 2FA key. |
164 | 164 | return; |
165 | - } |
|
166 | - else |
|
165 | + } else |
|
167 | 166 | { |
168 | 167 | $redirect = $this->request->variable('redirect', "{$this->root_path}index.{$this->php_ext}"); |
169 | 168 | if ($event['admin']) |
@@ -108,18 +108,15 @@ discard block |
||
108 | 108 | if ($module->can_register()) |
109 | 109 | { |
110 | 110 | $this->tpl_name = $module->register_start(); |
111 | - } |
|
112 | - else |
|
111 | + } else |
|
113 | 112 | { |
114 | 113 | $error[] = 'TFA_MODULE_NO_REGISTER'; |
115 | 114 | } |
116 | - } |
|
117 | - else |
|
115 | + } else |
|
118 | 116 | { |
119 | 117 | $error[] = $this->user->lang('TFA_MODULE_NOT_FOUND', $class); |
120 | 118 | } |
121 | - } |
|
122 | - catch (\Exception $e) |
|
119 | + } catch (\Exception $e) |
|
123 | 120 | { |
124 | 121 | $error[] = $e->getMessage(); |
125 | 122 | } |
@@ -151,8 +148,7 @@ discard block |
||
151 | 148 | if (!check_form_key('ucp_tfa_keys')) |
152 | 149 | { |
153 | 150 | $error[] = 'FORM_INVALID'; |
154 | - } |
|
155 | - else |
|
151 | + } else |
|
156 | 152 | { |
157 | 153 | if ($this->request->variable('md', false, false, \phpbb\request\request_interface::POST)) |
158 | 154 | { |
@@ -152,8 +152,7 @@ discard block |
||
152 | 152 | if (!empty($secure)) |
153 | 153 | { |
154 | 154 | return 'on' == strtolower($secure) || '1' == $secure; |
155 | - } |
|
156 | - else if ('443' == $this->request->server('SERVER_PORT')) |
|
155 | + } else if ('443' == $this->request->server('SERVER_PORT')) |
|
157 | 156 | { |
158 | 157 | return true; |
159 | 158 | } |
@@ -234,10 +233,12 @@ discard block |
||
234 | 233 | |
235 | 234 | if (property_exists($response, 'errorCode')) |
236 | 235 | { |
237 | - if ($response->errorCode == 4) // errorCode 4 means that this device wasn't registered |
|
236 | + if ($response->errorCode == 4) { |
|
237 | + // errorCode 4 means that this device wasn't registered |
|
238 | 238 | { |
239 | 239 | throw new AccessDeniedHttpException($this->user->lang('TFA_NOT_REGISTERED')); |
240 | 240 | } |
241 | + } |
|
241 | 242 | throw new BadRequestHttpException($this->user->lang('TFA_SOMETHING_WENT_WRONG')); |
242 | 243 | } |
243 | 244 | $result = new AuthenticationResponse($response->signatureData, $response->clientData, $response->keyHandle); // Do not need to include errorCode, as we already handled it. |
@@ -251,12 +252,10 @@ discard block |
||
251 | 252 | |
252 | 253 | $sql = 'UPDATE ' . $this->registration_table . ' SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' WHERE registration_id = ' . (int) $reg->getId(); |
253 | 254 | $this->db->sql_query($sql); |
254 | - } |
|
255 | - catch (U2fError $error) |
|
255 | + } catch (U2fError $error) |
|
256 | 256 | { |
257 | 257 | $this->createError($error); |
258 | - } |
|
259 | - catch (\InvalidArgumentException $invalid) |
|
258 | + } catch (\InvalidArgumentException $invalid) |
|
260 | 259 | { |
261 | 260 | throw new BadRequestHttpException($this->user->lang('TFA_SOMETHING_WENT_WRONG') . '<br />' . $invalid->getMessage(), $invalid); |
262 | 261 | } |
@@ -351,8 +350,7 @@ discard block |
||
351 | 350 | ); |
352 | 351 | |
353 | 352 | $this->update_session($sql_ary); |
354 | - } |
|
355 | - catch (U2fError $err) |
|
353 | + } catch (U2fError $err) |
|
356 | 354 | { |
357 | 355 | $this->createError($err); |
358 | 356 | } |
@@ -155,8 +155,7 @@ |
||
155 | 155 | $this->template->assign_var('S_ERROR', $this->user->lang('TFA_INCORRECT_KEY')); |
156 | 156 | $this->session_helper->generate_page($user_id, $admin, $auto_login, $viewonline, $redirect); |
157 | 157 | } |
158 | - } |
|
159 | - catch (BadRequestHttpException $ex) // @TODO: Replace exception with own exception |
|
158 | + } catch (BadRequestHttpException $ex) // @TODO: Replace exception with own exception |
|
160 | 159 | { |
161 | 160 | $this->template->assign_var('S_ERROR', $ex->getMessage()); |
162 | 161 | $this->session_helper->generate_page($user_id, $admin, $auto_login, $viewonline, $redirect); |