@@ -11,7 +11,6 @@ |
||
| 11 | 11 | namespace paul999\tfa\controller; |
| 12 | 12 | |
| 13 | 13 | use paul999\tfa\helper\session_helper_interface; |
| 14 | -use paul999\tfa\modules\module_interface; |
|
| 15 | 14 | use phpbb\config\config; |
| 16 | 15 | use phpbb\controller\helper; |
| 17 | 16 | use phpbb\db\driver\driver_interface; |
@@ -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 | |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | throw new BadRequestHttpException($this->user->lang('TFA_SOMETHING_WENT_WRONG')); |
| 122 | 122 | } |
| 123 | 123 | $random = $this->request->variable('random', ''); |
| 124 | - $cookie = $this->request->variable($this->config['cookie_name'] . 'rm', '', false, request_interface::COOKIE); |
|
| 124 | + $cookie = $this->request->variable($this->config['cookie_name'].'rm', '', false, request_interface::COOKIE); |
|
| 125 | 125 | |
| 126 | 126 | if ($this->user->data['tfa_random'] !== $cookie || $cookie !== $random || $this->user->data['tfa_random'] !== $random || strlen($random) != 40) |
| 127 | 127 | { |
@@ -131,9 +131,9 @@ discard block |
||
| 131 | 131 | 'tfa_random' => '', |
| 132 | 132 | 'tfa_uid' => 0, |
| 133 | 133 | ); |
| 134 | - $sql = 'UPDATE ' . SESSIONS_TABLE . ' SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' |
|
| 134 | + $sql = 'UPDATE '.SESSIONS_TABLE.' SET '.$this->db->sql_build_array('UPDATE', $sql_ary).' |
|
| 135 | 135 | WHERE |
| 136 | - session_id = \'' . $this->db->sql_escape($this->user->data['session_id']) . '\' AND |
|
| 136 | + session_id = \'' . $this->db->sql_escape($this->user->data['session_id']).'\' AND |
|
| 137 | 137 | session_user_id = ' . (int) $this->user->data['user_id']; |
| 138 | 138 | $this->db->sql_query($sql); |
| 139 | 139 | |
@@ -171,8 +171,8 @@ discard block |
||
| 171 | 171 | if ($admin) |
| 172 | 172 | { |
| 173 | 173 | // the login array is used because the user ids do not differ for re-authentication |
| 174 | - $sql = 'DELETE FROM ' . SESSIONS_TABLE . " |
|
| 175 | - WHERE session_id = '" . $this->db->sql_escape($old_session_id) . "' |
|
| 174 | + $sql = 'DELETE FROM '.SESSIONS_TABLE." |
|
| 175 | + WHERE session_id = '" . $this->db->sql_escape($old_session_id)."' |
|
| 176 | 176 | AND session_user_id = " . (int) $user_id; |
| 177 | 177 | $this->db->sql_query($sql); |
| 178 | 178 | |
@@ -19,7 +19,6 @@ |
||
| 19 | 19 | use phpbb\template\template; |
| 20 | 20 | use phpbb\user; |
| 21 | 21 | use Symfony\Component\EventDispatcher\EventSubscriberInterface; |
| 22 | -use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; |
|
| 23 | 22 | use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; |
| 24 | 23 | |
| 25 | 24 | /** |
@@ -89,12 +89,12 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | public function __construct(session_helper_interface $session_helper, helper $controller_helper, user $user, request_interface $request, driver_interface $db, config $config, template $template, $php_ext, $root_path) |
| 91 | 91 | { |
| 92 | - $this->session_helper = $session_helper; |
|
| 93 | - $this->controller_helper = $controller_helper; |
|
| 94 | - $this->user = $user; |
|
| 92 | + $this->session_helper = $session_helper; |
|
| 93 | + $this->controller_helper = $controller_helper; |
|
| 94 | + $this->user = $user; |
|
| 95 | 95 | $this->request = $request; |
| 96 | - $this->config = $config; |
|
| 97 | - $this->db = $db; |
|
| 96 | + $this->config = $config; |
|
| 97 | + $this->db = $db; |
|
| 98 | 98 | $this->php_ext = $php_ext; |
| 99 | 99 | $this->root_path = $root_path; |
| 100 | 100 | $this->template = $template; |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | } |
| 137 | 137 | if ($this->user->data['is_bot'] == false && $this->user->data['user_id'] != ANONYMOUS && $this->session_helper->isTfaRequired($this->user->data['user_id'], false, $this->user->data) && !$this->session_helper->isTfaRegistered($this->user->data['user_id'])) |
| 138 | 138 | { |
| 139 | - $sql = 'SELECT module_id FROM ' . MODULES_TABLE . ' WHERE module_langname = \'UCP_TFA\' OR module_langname = \'UCP_TFA_MANAGE\''; |
|
| 139 | + $sql = 'SELECT module_id FROM '.MODULES_TABLE.' WHERE module_langname = \'UCP_TFA\' OR module_langname = \'UCP_TFA_MANAGE\''; |
|
| 140 | 140 | $result = $this->db->sql_query($sql); |
| 141 | 141 | $allowed_i = array(); |
| 142 | 142 | |
@@ -148,13 +148,13 @@ discard block |
||
| 148 | 148 | $ucp_mode = "-paul999-tfa-ucp-tfa_module"; |
| 149 | 149 | $allowed_i[] = $ucp_mode; |
| 150 | 150 | |
| 151 | - if ($this->user->page['page_name'] == 'ucp.' . $this->php_ext && in_array($this->request->variable('i', ''), $allowed_i)) |
|
| 151 | + if ($this->user->page['page_name'] == 'ucp.'.$this->php_ext && in_array($this->request->variable('i', ''), $allowed_i)) |
|
| 152 | 152 | { |
| 153 | 153 | return; // We are at our UCP page, so skip any other checks. This page is always available |
| 154 | 154 | } |
| 155 | 155 | $this->user->add_lang_ext('paul999/tfa', 'common'); |
| 156 | 156 | $url = append_sid("{$this->root_path}ucp.{$this->php_ext}", "i={$ucp_mode}"); |
| 157 | - trigger_error($this->user->lang('TFA_REQUIRED_KEY_MISSING', '<a href="' . $url . '">', '</a>'), E_USER_WARNING); |
|
| 157 | + trigger_error($this->user->lang('TFA_REQUIRED_KEY_MISSING', '<a href="'.$url.'">', '</a>'), E_USER_WARNING); |
|
| 158 | 158 | |
| 159 | 159 | } |
| 160 | 160 | } |
@@ -234,9 +234,9 @@ discard block |
||
| 234 | 234 | 'tfa_random' => $random, |
| 235 | 235 | 'tfa_uid' => $user_id, |
| 236 | 236 | ); |
| 237 | - $sql = 'UPDATE ' . SESSIONS_TABLE . ' SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' |
|
| 237 | + $sql = 'UPDATE '.SESSIONS_TABLE.' SET '.$this->db->sql_build_array('UPDATE', $sql_ary).' |
|
| 238 | 238 | WHERE |
| 239 | - session_id = \'' . $this->db->sql_escape($this->user->data['session_id']) . '\' AND |
|
| 239 | + session_id = \'' . $this->db->sql_escape($this->user->data['session_id']).'\' AND |
|
| 240 | 240 | session_user_id = ' . (int) $this->user->data['user_id']; |
| 241 | 241 | $this->db->sql_query($sql); |
| 242 | 242 | |
@@ -182,8 +182,7 @@ discard block |
||
| 182 | 182 | // We simply return and continue the login procedure (The normal way :)), |
| 183 | 183 | // and will disable all pages untill he has added a 2FA key. |
| 184 | 184 | return $event; |
| 185 | - } |
|
| 186 | - else |
|
| 185 | + } else |
|
| 187 | 186 | { |
| 188 | 187 | $this->user->add_lang_ext('paul999/tfa', 'common'); |
| 189 | 188 | $user_id = $event['user_id']; |
@@ -196,8 +195,7 @@ discard block |
||
| 196 | 195 | if (!empty($class) && $class != '_') |
| 197 | 196 | { |
| 198 | 197 | $module = $this->session_helper->findModule($class); |
| 199 | - } |
|
| 200 | - else |
|
| 198 | + } else |
|
| 201 | 199 | { |
| 202 | 200 | /** |
| 203 | 201 | * @var module_interface $row |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | { |
| 25 | 25 | return array( |
| 26 | 26 | 'add_columns' => array( |
| 27 | - $this->table_prefix . 'sessions' => array( |
|
| 27 | + $this->table_prefix.'sessions' => array( |
|
| 28 | 28 | 'u2f_request' => array('TEXT', null), |
| 29 | 29 | ), |
| 30 | 30 | ), |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | { |
| 36 | 36 | return array( |
| 37 | 37 | 'drop_columns' => array( |
| 38 | - $this->table_prefix . 'sessions' => array( |
|
| 38 | + $this->table_prefix.'sessions' => array( |
|
| 39 | 39 | 'u2f_request', |
| 40 | 40 | ), |
| 41 | 41 | ), |