@@ -199,8 +199,7 @@ |
||
199 | 199 | // We simply return and continue the login procedure (The normal way :)), |
200 | 200 | // and will disable all pages until he has added a 2FA key. |
201 | 201 | return $event; |
202 | - } |
|
203 | - else |
|
202 | + } else |
|
204 | 203 | { |
205 | 204 | $this->session_helper->generate_page($event['login']['user_row']['user_id'], $event['admin'], $event['autologin'], !$this->request->is_set_post('viewonline'), $this->request->variable('redirect', '')); |
206 | 205 | } |
@@ -69,26 +69,26 @@ discard block |
||
69 | 69 | * @var string |
70 | 70 | */ |
71 | 71 | private $php_ext; |
72 | - /** |
|
73 | - * @var phpbb\log\log |
|
74 | - */ |
|
75 | - private $log; |
|
76 | - |
|
77 | - /** |
|
78 | - * Constructor |
|
79 | - * |
|
80 | - * @access public |
|
81 | - * @param helper $controller_helper |
|
82 | - * @param driver_interface $db |
|
83 | - * @param template $template |
|
84 | - * @param user $user |
|
85 | - * @param request_interface $request |
|
86 | - * @param config $config |
|
87 | - * @param log $log |
|
88 | - * @param session_helper_interface $session_helper |
|
89 | - * @param string $root_path |
|
90 | - * @param string $php_ext |
|
91 | - */ |
|
72 | + /** |
|
73 | + * @var phpbb\log\log |
|
74 | + */ |
|
75 | + private $log; |
|
76 | + |
|
77 | + /** |
|
78 | + * Constructor |
|
79 | + * |
|
80 | + * @access public |
|
81 | + * @param helper $controller_helper |
|
82 | + * @param driver_interface $db |
|
83 | + * @param template $template |
|
84 | + * @param user $user |
|
85 | + * @param request_interface $request |
|
86 | + * @param config $config |
|
87 | + * @param log $log |
|
88 | + * @param session_helper_interface $session_helper |
|
89 | + * @param string $root_path |
|
90 | + * @param string $php_ext |
|
91 | + */ |
|
92 | 92 | public function __construct(helper $controller_helper, driver_interface $db, template $template, user $user, request_interface $request, config $config, log $log, session_helper_interface $session_helper, $root_path, $php_ext) |
93 | 93 | { |
94 | 94 | $this->controller_helper = $controller_helper; |
@@ -100,8 +100,8 @@ discard block |
||
100 | 100 | $this->session_helper = $session_helper; |
101 | 101 | $this->root_path = $root_path; |
102 | 102 | $this->php_ext = $php_ext; |
103 | - $this->log = $log; |
|
104 | - } |
|
103 | + $this->log = $log; |
|
104 | + } |
|
105 | 105 | |
106 | 106 | /** |
107 | 107 | * @param int $user_id |
@@ -165,12 +165,12 @@ discard block |
||
165 | 165 | catch (http_exception $ex) // @TODO: Replace exception with own exception |
166 | 166 | { |
167 | 167 | |
168 | - $this->log->add('error', $this->user->data['user_id'], $this->user->ip, 'LOG_TFA_EXCEPTION', $ex->getMessage()); |
|
168 | + $this->log->add('error', $this->user->data['user_id'], $this->user->ip, 'LOG_TFA_EXCEPTION', $ex->getMessage()); |
|
169 | 169 | |
170 | - if ($admin) { |
|
171 | - // Also log it to admin log just to be sure. |
|
172 | - $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_TFA_EXCEPTION', $ex->getMessage()); |
|
173 | - } |
|
170 | + if ($admin) { |
|
171 | + // Also log it to admin log just to be sure. |
|
172 | + $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_TFA_EXCEPTION', $ex->getMessage()); |
|
173 | + } |
|
174 | 174 | if ($ex->getStatusCode() == 400) |
175 | 175 | { |
176 | 176 | $this->template->assign_var('S_ERROR', $this->user->lang($ex->getMessage())); |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | AND session_user_id = " . (int) $user_id; |
206 | 206 | $this->db->sql_query($sql); |
207 | 207 | |
208 | - $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_ADMIN_AUTH_SUCCESS'); |
|
208 | + $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_ADMIN_AUTH_SUCCESS'); |
|
209 | 209 | |
210 | 210 | redirect(append_sid("{$this->root_path}adm/index.{$this->php_ext}", false, true, $this->user->data['session_id'])); |
211 | 211 | } |
@@ -91,16 +91,16 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function __construct(helper $controller_helper, driver_interface $db, template $template, user $user, request_interface $request, config $config, log $log, session_helper_interface $session_helper, $root_path, $php_ext) |
93 | 93 | { |
94 | - $this->controller_helper = $controller_helper; |
|
95 | - $this->template = $template; |
|
96 | - $this->db = $db; |
|
97 | - $this->user = $user; |
|
98 | - $this->request = $request; |
|
99 | - $this->config = $config; |
|
100 | - $this->session_helper = $session_helper; |
|
101 | - $this->root_path = $root_path; |
|
102 | - $this->php_ext = $php_ext; |
|
103 | - $this->log = $log; |
|
94 | + $this->controller_helper = $controller_helper; |
|
95 | + $this->template = $template; |
|
96 | + $this->db = $db; |
|
97 | + $this->user = $user; |
|
98 | + $this->request = $request; |
|
99 | + $this->config = $config; |
|
100 | + $this->session_helper = $session_helper; |
|
101 | + $this->root_path = $root_path; |
|
102 | + $this->php_ext = $php_ext; |
|
103 | + $this->log = $log; |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
@@ -135,9 +135,9 @@ discard block |
||
135 | 135 | 'tfa_random' => '', |
136 | 136 | 'tfa_uid' => 0, |
137 | 137 | ); |
138 | - $sql = 'UPDATE ' . SESSIONS_TABLE . ' SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . " |
|
138 | + $sql = 'UPDATE '.SESSIONS_TABLE.' SET '.$this->db->sql_build_array('UPDATE', $sql_ary)." |
|
139 | 139 | WHERE |
140 | - session_id = '" . $this->db->sql_escape($this->user->data['session_id']) . "' AND |
|
140 | + session_id = '" . $this->db->sql_escape($this->user->data['session_id'])."' AND |
|
141 | 141 | session_user_id = " . (int) $this->user->data['user_id']; |
142 | 142 | $this->db->sql_query($sql); |
143 | 143 | |
@@ -200,8 +200,8 @@ discard block |
||
200 | 200 | if ($admin) |
201 | 201 | { |
202 | 202 | // the login array is used because the user ids do not differ for re-authentication |
203 | - $sql = 'DELETE FROM ' . SESSIONS_TABLE . " |
|
204 | - WHERE session_id = '" . $this->db->sql_escape($old_session_id) . "' |
|
203 | + $sql = 'DELETE FROM '.SESSIONS_TABLE." |
|
204 | + WHERE session_id = '" . $this->db->sql_escape($old_session_id)."' |
|
205 | 205 | AND session_user_id = " . (int) $user_id; |
206 | 206 | $this->db->sql_query($sql); |
207 | 207 |
@@ -161,8 +161,7 @@ discard block |
||
161 | 161 | $this->template->assign_var('S_ERROR', $this->user->lang('TFA_INCORRECT_KEY')); |
162 | 162 | $this->session_helper->generate_page($user_id, $admin, $auto_login, $viewonline, $redirect); |
163 | 163 | } |
164 | - } |
|
165 | - catch (http_exception $ex) // @TODO: Replace exception with own exception |
|
164 | + } catch (http_exception $ex) // @TODO: Replace exception with own exception |
|
166 | 165 | { |
167 | 166 | |
168 | 167 | $this->log->add('error', $this->user->data['user_id'], $this->user->ip, 'LOG_TFA_EXCEPTION', $ex->getMessage()); |
@@ -175,8 +174,7 @@ discard block |
||
175 | 174 | { |
176 | 175 | $this->template->assign_var('S_ERROR', $this->user->lang($ex->getMessage())); |
177 | 176 | $this->session_helper->generate_page($user_id, $admin, $auto_login, $viewonline, $redirect); |
178 | - } |
|
179 | - else |
|
177 | + } else |
|
180 | 178 | { |
181 | 179 | throw $ex; |
182 | 180 | } |