File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
app/Http/Controllers/Api/Auth Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change 77use App \Auth \Dispensary \Exceptions \TokenExpiredException ;
88use App \Auth \LoginDispensary ;
99use App \Models \User ;
10+ use App \Models \UserToken ;
1011use App \SPA \UrlGenerator ;
1112use Illuminate \Contracts \Routing \ResponseFactory ;
1213use Illuminate \Contracts \Translation \Translator ;
@@ -64,7 +65,11 @@ public function __invoke(Request $request): RedirectResponse
6465 return $ this ->responseFactory ->redirectTo ($ url );
6566 }
6667
67- $ user ->tokens ()->create (['token ' => $ token = Str::random (128 )]);
68+ do {
69+ $ token = Str::random (128 );
70+ } while (UserToken::query ()->where ('token ' , $ token )->doesntExist ());
71+
72+ $ user ->tokens ()->create (['token ' => $ token ]);
6873
6974 return $ this ->responseFactory ->redirectTo ($ url . '#token= ' . $ token );
7075 } catch (TokenExpiredException $ exception ) {
You can’t perform that action at this time.
0 commit comments