Skip to content

Commit df7548a

Browse files
committed
refac
1 parent dff7bf7 commit df7548a

5 files changed

Lines changed: 3 additions & 20 deletions

File tree

GaelO2/app/GaelO/Repositories/UserRepository.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ public function __construct(User $user, Role $roles, CenterUser $centerUser, Stu
3535

3636
public function find($id): array
3737
{
38-
return $this->userModel->findOrFail($id)->makeVisible([
39-
'two_factor_confirmed_at'
40-
])->toArray();
38+
return $this->userModel->findOrFail($id)->toArray();
4139
}
4240

4341
public function delete($id): void

GaelO2/app/Http/Controllers/AuthController.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,6 @@ public function recoveryCodeChallenge(
191191

192192
/**
193193
* Generate 2FA secret + QR code SVG for the authenticated user.
194-
* Route protected by auth:sanctum — the Bearer token from login
195-
* is sent explicitly by the front before being stored in Redux.
196194
*/
197195
public function setup2FA(Request $request, TwoFactorAuthenticationProvider $provider, int $userId): JsonResponse
198196
{
@@ -277,12 +275,7 @@ public function generateRecoveryCodes2FA(Request $request, int $userId): JsonRes
277275

278276
// Decrypt to return the code on the front side
279277
$codes = $user->recoveryCodes();
280-
foreach ($codes as $code) {
281-
$user->replaceRecoveryCode($code);
282-
}
283-
284-
$updatedCodes = $user->recoveryCodes();
285-
return response()->json(['recoveryCodes' => $updatedCodes]);
278+
return response()->json(['recoveryCodes' => $codes]);
286279
}
287280

288281
public function delete2FA(Request $request, int $userId)

GaelO2/app/Models/User.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ class User extends Authenticatable implements CanResetPassword, MustVerifyEmail
3333
*
3434
* @var array
3535
*/
36-
protected $hidden = [
37-
'remember_token'
38-
];
36+
protected $hidden = [];
3937

4038
/**
4139
* The attributes that should be cast to native types.

GaelO2/app/Providers/FortifyServiceProvider.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@
77

88
class FortifyServiceProvider extends ServiceProvider
99
{
10-
public function register(): void
11-
{
12-
// Forcer toutes les routes Fortify sous le middleware API avec auth Sanctum
13-
config(['fortify.middleware' => ['api', 'auth:sanctum']]);
14-
}
1510

1611
public function boot(): void
1712
{

GaelO2/database/seeders/UserSeeder.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ public function run()
2525
'center_code' => 0,
2626
'job' => 'Monitor',
2727
'administrator' => true,
28-
'remember_token' => Str::random(10),
2928
'email_verified_at' => now(),
3029
'onboarding_version' => '1.0.0'
3130
]);

0 commit comments

Comments
 (0)