Completed
Push — master ( 405b48...08db4b )
by Paul
13:36
created
controller/main_controller.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -98,16 +98,16 @@  discard block
 block discarded – undo
98 98
 	 */
99 99
 	public function __construct(helper $controller_helper, driver_interface $db, template $template, user $user, request_interface $request, config $config, $root_path, $php_ext, $user_table, $registration_table)
100 100
 	{
101
-		$this->controller_helper 	= $controller_helper;
102
-		$this->template 			= $template;
103
-		$this->db					= $db;
104
-		$this->user					= $user;
101
+		$this->controller_helper = $controller_helper;
102
+		$this->template = $template;
103
+		$this->db = $db;
104
+		$this->user = $user;
105 105
 		$this->request				= $request;
106
-		$this->config				= $config;
107
-		$this->root_path			= $root_path;
106
+		$this->config = $config;
107
+		$this->root_path = $root_path;
108 108
 		$this->php_ext				= $php_ext;
109
-		$this->user_table			= $user_table;
110
-		$this->registration_table	= $registration_table;
109
+		$this->user_table = $user_table;
110
+		$this->registration_table = $registration_table;
111 111
 
112 112
 		$this->u2f = new U2F('https://' . $this->request->server('HTTP_HOST'));
113 113
 	}
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 		{
204 204
 			$response = json_decode(htmlspecialchars_decode($this->request->variable('authenticate', '')));
205 205
 
206
-			if (property_exists( $response, 'errorCode'))
206
+			if (property_exists($response, 'errorCode'))
207 207
 			{
208 208
 				if ($response->errorCode == 4) // errorCode 4 means that this device wasn't registered
209 209
 				{
@@ -276,13 +276,13 @@  discard block
 block discarded – undo
276 276
 
277 277
 		while ($row = $this->db->sql_fetchrow($result))
278 278
 		{
279
-			$reg 				= new registration_helper();
279
+			$reg = new registration_helper();
280 280
 			$reg->setCounter($row['counter']);
281 281
 			$reg->setCertificate($row['certificate']);
282 282
 			$reg->setKeyHandle($row['key_handle']);
283 283
 			$reg->setPublicKey($row['public_key']);
284
-			$reg->id 			= $row['registration_id'];
285
-			$rows[] 			= $reg;
284
+			$reg->id = $row['registration_id'];
285
+			$rows[] = $reg;
286 286
 		}
287 287
 
288 288
 		$this->db->sql_freeresult($result);
Please login to merge, or discard this patch.
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -205,10 +205,12 @@  discard block
 block discarded – undo
205 205
 
206 206
 			if (property_exists( $response, 'errorCode'))
207 207
 			{
208
-				if ($response->errorCode == 4) // errorCode 4 means that this device wasn't registered
208
+				if ($response->errorCode == 4) {
209
+					// errorCode 4 means that this device wasn't registered
209 210
 				{
210 211
 					throw new AccessDeniedHttpException($this->user->lang('TFA_NOT_REGISTERED'));
211 212
 				}
213
+				}
212 214
 			}
213 215
 
214 216
 			/** @var \paul999\tfa\helper\registration_helper $reg */
@@ -250,12 +252,10 @@  discard block
 block discarded – undo
250 252
 				redirect(append_sid($redirect, false, true, $this->user->data['session_id']));
251 253
 			}
252 254
 			throw new BadRequestHttpException($this->user->lang('TFA_SOMETHING_WENT_WRONG'));
253
-		}
254
-		catch (U2fError $error)
255
+		} catch (U2fError $error)
255 256
 		{
256 257
 			$this->createError($error);
257
-		}
258
-		catch (\InvalidArgumentException $invalid)
258
+		} catch (\InvalidArgumentException $invalid)
259 259
 		{
260 260
 			throw new BadRequestHttpException($this->user->lang('TFA_SOMETHING_WENT_WRONG') . '<br />' . $invalid->getMessage(), $invalid);
261 261
 		}
Please login to merge, or discard this patch.