Skip to content

Commit b691b3f

Browse files
fix: do not while loop forever until we have a duplicate token :')
1 parent 30182cb commit b691b3f

File tree

3 files changed

+293
-313
lines changed

3 files changed

+293
-313
lines changed

app/Http/Controllers/Api/Auth/Dispense.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function __invoke(Request $request): RedirectResponse
6767

6868
do {
6969
$token = Str::random(128);
70-
} while (UserToken::query()->where('token', $token)->doesntExist());
70+
} while (UserToken::query()->where('token', $token)->exists());
7171

7272
$user->tokens()->create(['token' => $token]);
7373

app/Providers/AuthServiceProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ public function boot(): void
3030
{
3131
$this->registerPolicies();
3232

33-
$this->registerDispensary();
33+
$this->registerSpaRequestGuard();
3434
}
3535

3636
/**
3737
* @throws \Illuminate\Contracts\Container\BindingResolutionException
3838
*/
39-
private function registerDispensary(): void
39+
private function registerSpaRequestGuard(): void
4040
{
4141
/** @var AuthManager $authManager */
4242
$authManager = $this->app->make(AuthManager::class);

0 commit comments

Comments
 (0)