Passed
Push — feature/add-2fa-support ( dce790...5e424a )
by Tristan
12:13
created
app/Models/Criteria.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,8 +28,8 @@
 block discarded – undo
28 28
  * @property string $level_description The localized description of the skill level (accounts for skill type).
29 29
  *
30 30
  *  Localized Properties:
31
-  * @property string $description
32
-  * @property string $specificity
31
+ * @property string $description
32
+ * @property string $specificity
33 33
  */
34 34
 class Criteria extends BaseModel
35 35
 {
Please login to merge, or discard this patch.
app/Models/JobPoster.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
      */
367 367
     public function submitted_applications() // phpcs:ignore
368 368
     {
369
-        return $this->hasMany(\App\Models\JobApplication::class)->whereDoesntHave('application_status', function ($query): void {
369
+        return $this->hasMany(\App\Models\JobApplication::class)->whereDoesntHave('application_status', function($query): void {
370 370
             $query->where('name', 'draft');
371 371
         });
372 372
     }
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
     public function getClassificationMessageAttribute()
556 556
     {
557 557
         if ($this->classification_id !== null && $this->classification_level !== null) {
558
-            return $this->classification->key . '-0' . $this->classification_level;
558
+            return $this->classification->key.'-0'.$this->classification_level;
559 559
         }
560 560
         return null;
561 561
     }
Please login to merge, or discard this patch.
app/Models/Manager.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -187,7 +187,7 @@
 block discarded – undo
187 187
     public function getFullNameAttribute(): string
188 188
     {
189 189
         if ($this->user !== null) {
190
-            return $this->user->first_name . ' ' . $this->user->last_name;
190
+            return $this->user->first_name.' '.$this->user->last_name;
191 191
         }
192 192
         return '';
193 193
     }
Please login to merge, or discard this patch.
app/Http/Controllers/JobController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -126,12 +126,12 @@
 block discarded – undo
126 126
         // TODO: replace route('manager.show',manager.id) in templates with link using slug.
127 127
         $criteria = [
128 128
             'essential' => $jobPoster->criteria->filter(
129
-                function ($value, $key) {
129
+                function($value, $key) {
130 130
                     return $value->criteria_type->name == 'essential';
131 131
                 }
132 132
             ),
133 133
             'asset' => $jobPoster->criteria->filter(
134
-                function ($value, $key) {
134
+                function($value, $key) {
135 135
                     return $value->criteria_type->name == 'asset';
136 136
                 }
137 137
             ),
Please login to merge, or discard this patch.
database/factories/JobPosterFactory.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 
18 18
 $faker_fr = Faker\Factory::create('fr');
19 19
 
20
-$factory->define(JobPoster::class, function (Faker\Generator $faker) use ($faker_fr) {
20
+$factory->define(JobPoster::class, function(Faker\Generator $faker) use ($faker_fr) {
21 21
     $closeDate = $faker->dateTimeBetween('now', '1 months')->format('Y-m-d');
22 22
     $openDate = $faker->dateTimeBetween('-1 months', 'now')->format('Y-m-d');
23 23
     $startDate = $faker->dateTimeBetween('1 months', '2 months')->format('Y-m-d');
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         'security_clearance_id' => SecurityClearance::inRandomOrder()->first()->id,
61 61
         'language_requirement_id' => LanguageRequirement::inRandomOrder()->first()->id,
62 62
         'remote_work_allowed' => $faker->boolean(50),
63
-        'manager_id' => function () {
63
+        'manager_id' => function() {
64 64
             return factory(Manager::class)->create()->id;
65 65
         },
66 66
         'team_size' => $faker->numberBetween(5, 30),
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
     ];
99 99
 });
100 100
 
101
-$factory->afterCreating(JobPoster::class, function ($jp) : void {
101
+$factory->afterCreating(JobPoster::class, function($jp) : void {
102 102
     $jp->criteria()->saveMany(factory(Criteria::class, 5)->make([
103 103
         'job_poster_id' => $jp->id
104 104
     ]));
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 $factory->state(
114 114
     JobPoster::class,
115 115
     'byUpgradedManager',
116
-    ['manager_id' => function () {
116
+    ['manager_id' => function() {
117 117
             return factory(Manager::class)->state('upgraded')->create()->id;
118 118
     }]
119 119
 );
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 $factory->state(
122 122
     JobPoster::class,
123 123
     'published',
124
-    function (Faker\Generator $faker) {
124
+    function(Faker\Generator $faker) {
125 125
         return [
126 126
             'published' => true,
127 127
             'published_at' => $faker->dateTimeBetween('-1 months', '-3 weeks')
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 $factory->state(
133 133
     JobPoster::class,
134 134
     'closed',
135
-    function (Faker\Generator $faker) {
135
+    function(Faker\Generator $faker) {
136 136
         return [
137 137
             'published' => true,
138 138
             'published_at' => $faker->dateTimeBetween('-1 months', '-3 weeks'),
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 $factory->state(
145 145
     JobPoster::class,
146 146
     'draft',
147
-    function (Faker\Generator $faker) {
147
+    function(Faker\Generator $faker) {
148 148
         return [
149 149
             'published' => false,
150 150
             'open_date_time' => ptDayStartToUtcTime($faker->dateTimeBetween('5 days', '10 days')->format('Y-m-d')),
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 $factory->state(
159 159
     JobPoster::class,
160 160
     'review_requested',
161
-    function (Faker\Generator $faker) {
161
+    function(Faker\Generator $faker) {
162 162
         return [
163 163
             'published' => false,
164 164
             'open_date_time' => ptDayStartToUtcTime($faker->dateTimeBetween('5 days', '10 days')->format('Y-m-d')),
Please login to merge, or discard this patch.
app/Traits/RememberDeviceTrait.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -20,8 +20,8 @@  discard block
 block discarded – undo
20 20
      */
21 21
     public function getRememberDeviceToken()
22 22
     {
23
-        if (! empty($this->getRememberDeviceTokenName())) {
24
-            return (string) $this->{$this->getRememberDeviceTokenName()};
23
+        if (!empty($this->getRememberDeviceTokenName())) {
24
+            return (string)$this->{$this->getRememberDeviceTokenName()};
25 25
         }
26 26
     }
27 27
 
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
      */
34 34
     public function setRememberDeviceToken($value)
35 35
     {
36
-        if (! empty($this->getRememberDeviceTokenName())) {
36
+        if (!empty($this->getRememberDeviceTokenName())) {
37 37
             // Make sure new value is immediately saved to db, as well as to model object.
38 38
             $this->where('id', $this->id)->update([$this->getRememberDeviceTokenName() => $value]);
39 39
             $this->{$this->getRememberDeviceTokenName()} = $value;
Please login to merge, or discard this patch.
app/Http/Middleware/Google2FA.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -23,9 +23,9 @@
 block discarded – undo
23 23
             $remember = $request->cookie($user->getRememberDeviceKey());
24 24
             // If tokens do not match, cookie is no longer valid.
25 25
             if ($remember !== null && $remember !== $user->getRememberDeviceToken()) {
26
-                 Cookie::queue(
27
-                     Cookie::forget($user->getRememberDeviceKey())
28
-                 );
26
+                    Cookie::queue(
27
+                        Cookie::forget($user->getRememberDeviceKey())
28
+                    );
29 29
             }
30 30
 
31 31
             if ($authenticator->isAuthenticated() || ($remember !== null && $remember === $user->getRememberDeviceToken())) {
Please login to merge, or discard this patch.
app/Http/Controllers/Auth/TwoFactorController.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
             $user->email,
21 21
             $secret
22 22
         );
23
-         $profile_url = '';
23
+            $profile_url = '';
24 24
         if (WhichPortal::isApplicantPortal()) {
25 25
             $profile_url = route('settings.edit');
26 26
         } elseif (WhichPortal::isManagerPortal()) {
Please login to merge, or discard this patch.
routes/web.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -19,10 +19,10 @@  discard block
 block discarded – undo
19 19
         'prefix' => LaravelLocalization::setLocale(),
20 20
         'middleware' => ['localeSessionRedirect', 'localizationRedirect', 'localeViewPath']
21 21
     ],
22
-    function (): void {
22
+    function(): void {
23 23
         /* Routes used for local demos */
24 24
         /* If creating public demos, make sure to add a meta robots noindex, nofollow tag */
25
-        Route::group(['prefix' => 'demo'], function (): void {
25
+        Route::group(['prefix' => 'demo'], function(): void {
26 26
 
27 27
             /* Temporary Blog Index */
28 28
             Route::view('blog', 'common/blog-index')->middleware('localOnly')->name('blog');
@@ -51,13 +51,13 @@  discard block
 block discarded – undo
51 51
             Route::view('builder-08', 'manager/builder-08')->middleware('localOnly')->name('jpb8');
52 52
         });
53 53
 
54
-        Route::group(['prefix' => config('app.applicant_prefix')], function (): void {
54
+        Route::group(['prefix' => config('app.applicant_prefix')], function(): void {
55 55
 
56 56
             Route::get('two-factor/use-recovery-code', 'Auth\RecoveryCodeController@use')->name('recovery_codes.use');
57 57
             Route::post('two-factor/use-recovery-code', 'Auth\RecoveryCodeController@authenticate')->name('recovery_codes.authenticate');
58 58
 
59 59
             /* Require being logged in */
60
-            Route::middleware(['auth'])->group(function () : void {
60
+            Route::middleware(['auth'])->group(function() : void {
61 61
 
62 62
                 /* Managers */
63 63
                 Route::get('managers/{manager}', 'ManagerProfileController@show')
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
              * IF user is logged in AND has activated 2fa, require one-time password.
70 70
              * This should include all routes except those related to authentication, to avoid loops.
71 71
              */
72
-            Route::middleware(['2fa'])->group(function (): void {
72
+            Route::middleware(['2fa'])->group(function(): void {
73 73
                 Route::post('/2fa', 'Auth\TwoFactorController@redirectToExpected')->name('2fa');
74 74
 
75 75
                 /* Home */
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
                     ->name('jobs.show');
84 84
 
85 85
                 /* Require being logged in as applicant */
86
-                Route::middleware(['auth', 'role:applicant'])->group(function (): void {
86
+                Route::middleware(['auth', 'role:applicant'])->group(function(): void {
87 87
 
88 88
                     // Application permissions are handled within the controller instead of with middleware.
89 89
                     /* Applications */
@@ -253,9 +253,9 @@  discard block
 block discarded – undo
253 253
         });
254 254
 
255 255
         /* Manager Portal =========================================================== */
256
-        Route::group(['prefix' => config('app.manager_prefix')], function (): void {
256
+        Route::group(['prefix' => config('app.manager_prefix')], function(): void {
257 257
 
258
-            Route::middleware(['finishManagerRegistration'])->group(function (): void {
258
+            Route::middleware(['finishManagerRegistration'])->group(function(): void {
259 259
 
260 260
                 Route::get('two-factor/use-recovery-code', 'Auth\RecoveryCodeController@use')->name('manager.recovery_codes.use');
261 261
                 Route::post('two-factor/use-recovery-code', 'Auth\RecoveryCodeController@authenticate')->name('manager.recovery_codes.authenticate');
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
                  * IF user is logged in AND has activated 2fa, require one-time password.
265 265
                  * This should include all routes except those related to authentication, to avoid loops.
266 266
                  */
267
-                Route::middleware(['2fa'])->group(function (): void {
267
+                Route::middleware(['2fa'])->group(function(): void {
268 268
 
269 269
                     Route::post('/2fa', 'Auth\TwoFactorController@redirectToExpected')->name('manager.2fa');
270 270
 
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
                         'ManagerProfileController@faq'
283 283
                     )->name('manager.faq.section');
284 284
 
285
-                    Route::middleware(['auth', 'role:manager'])->group(function (): void {
285
+                    Route::middleware(['auth', 'role:manager'])->group(function(): void {
286 286
 
287 287
                         Route::get('profile', 'ManagerProfileController@editAuthenticated')->name('manager.profile');
288 288
 
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
                             ->name('manager.profile.update');
298 298
 
299 299
                         /* Reviewing applications/applicants requires two-factor authentication */
300
-                        Route::middleware(['2fa.required'])->group(function (): void {
300
+                        Route::middleware(['2fa.required'])->group(function(): void {
301 301
                             Route::get('jobs/{jobPoster}/applications', 'ApplicationByJobController@index')
302 302
                                 ->where('jobPoster', '[0-9]+')
303 303
                                 ->middleware('can:reviewApplicationsFor,jobPoster')
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
 
431 431
             // These routes must be excluded from the finishManagerRegistration middleware
432 432
             // to avoid an infinite loop of redirects.
433
-            Route::middleware(['auth', 'role:manager'])->group(function (): void {
433
+            Route::middleware(['auth', 'role:manager'])->group(function(): void {
434 434
                 Route::get('first-visit', 'Auth\FirstVisitController@showFirstVisitManagerForm')
435 435
                     ->name('manager.first_visit');
436 436
                 Route::post('finish_registration', 'Auth\FirstVisitController@finishManagerRegistration')
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
         /* AJAX calls =============================================================== */
457 457
 
458 458
         /* Require being logged in */
459
-        Route::middleware(['auth'])->group(function (): void {
459
+        Route::middleware(['auth'])->group(function(): void {
460 460
 
461 461
             Route::delete('courses/{course}', 'CourseController@destroy')
462 462
                 ->middleware('can:delete,course')
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
                 'prefix' => 'admin',
522 522
                 'middleware' => ['auth', 'role:admin']
523 523
             ],
524
-            function (): void {
524
+            function(): void {
525 525
                 /* Edit Job */
526 526
                 Route::get('jobs/{jobPoster}/edit', 'JobController@edit')
527 527
                     ->where('jobPoster', '[0-9]+')
@@ -542,7 +542,7 @@  discard block
 block discarded – undo
542 542
     'prefix' => 'admin',
543 543
     'middleware' => ['auth', 'role:admin']
544 544
     ],
545
-    function (): void {
545
+    function(): void {
546 546
         // This page is non-localized, because the middleware that redirects to localized
547 547
         // pages changes POSTs to GETs and messes up the request.
548 548
         Route::post('jobs/create/as-manager/{manager}', 'JobController@createAsManager')
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
 /* ALL NON-LOCALIZED ROUTES **/
565 565
 
566 566
 /* API routes - currently using same default http auth, but not localized */
567
-Route::group(['prefix' => 'api'], function (): void {
567
+Route::group(['prefix' => 'api'], function(): void {
568 568
     // Protected by a gate in the controller, instead of policy middleware.
569 569
     Route::get('jobs/{jobPoster}/assessment-plan', 'AssessmentPlanController@getForJob');
570 570
     // Public, not protected by policy or gate.
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
         ->name('api.jobs.submit');
608 608
     Route::resource('jobs', 'Api\JobApiController')->only([
609 609
         'show', 'store', 'update'
610
-    ])->names([ // Specify custom names because default names collied with existing routes.
610
+    ])->names([// Specify custom names because default names collied with existing routes.
611 611
         'show' => 'api.jobs.show',
612 612
         'store' => 'api.jobs.store',
613 613
         'update' => 'api.jobs.update'
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
 
616 616
     Route::resource('managers', 'Api\ManagerApiController')->only([
617 617
         'show', 'update'
618
-    ])->names([ // Specify custom names because default names collied with existing routes.
618
+    ])->names([// Specify custom names because default names collied with existing routes.
619 619
         'show' => 'api.managers.show',
620 620
         'update' => 'api.managers.update'
621 621
     ]);
Please login to merge, or discard this patch.