File tree Expand file tree Collapse file tree 2 files changed +28
-2
lines changed Expand file tree Collapse file tree 2 files changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ class HashCommand extends Command
2929 public function handle ()
3030 {
3131 if (! Passport::$ hashesClientSecrets ) {
32- $ this ->warn ('Please enable client hashing yet in your AppServiceProvider before continuning . ' );
32+ $ this ->warn ('Please enable client hashing yet in your AppServiceProvider before continuing . ' );
3333
3434 return ;
3535 }
@@ -45,7 +45,7 @@ public function handle()
4545 $ client ->timestamps = false ;
4646
4747 $ client ->forceFill ([
48- 'secret ' => password_hash ( $ client ->secret , PASSWORD_BCRYPT ) ,
48+ 'secret ' => $ client ->secret ,
4949 ])->save ();
5050 }
5151
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Laravel \Passport \Tests \Feature \Console ;
4+
5+ use Illuminate \Contracts \Hashing \Hasher ;
6+ use Illuminate \Support \Str ;
7+ use Laravel \Passport \Client ;
8+ use Laravel \Passport \Passport ;
9+ use Laravel \Passport \Tests \Feature \PassportTestCase ;
10+
11+ class HashCommand extends PassportTestCase
12+ {
13+ public function test_it_can_properly_has_client_secrets ()
14+ {
15+ $ client = factory (Client::class)->create (['secret ' => $ secret = Str::random (40 )]);
16+ $ hasher = $ this ->app ->make (Hasher::class);
17+
18+ Passport::hashClientSecrets ();
19+
20+ $ this ->artisan ('passport:hash ' , ['--force ' => true ]);
21+
22+ $ this ->assertTrue ($ hasher ->check ($ secret , $ client ->refresh ()->secret ));
23+
24+ Passport::$ hashesClientSecrets = false ;
25+ }
26+ }
You can’t perform that action at this time.
0 commit comments