forked from 404labfr/laravel-impersonate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from Arne1303/patch-issue-162
Fix issue 404labfr#162
- Loading branch information
Showing
4 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,6 +44,14 @@ public function up() | |
'can_be_impersonated' => 1, | ||
'created_at' => Carbon::now()->toDateTimeString(), | ||
], | ||
[ | ||
'name' => 'Different Password User', | ||
'email' => '[email protected]', | ||
'password' => bcrypt('different-password'), | ||
'is_admin' => 0, | ||
'can_be_impersonated' => 1, | ||
'created_at' => Carbon::now()->toDateTimeString(), | ||
], | ||
[ | ||
'name' => 'SuperAdmin', | ||
'email' => '[email protected]', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
namespace Lab404\Tests; | ||
|
||
use Illuminate\Support\Facades\Hash; | ||
use Lab404\Tests\Stubs\Models\User; | ||
|
||
class SessionGuardTest extends TestCase | ||
{ | ||
/** @var String $guard */ | ||
private $guard; | ||
|
||
public function setUp(): void | ||
{ | ||
parent::setUp(); | ||
$this->guard = 'web'; | ||
} | ||
|
||
/** @test */ | ||
public function it_updates_password_hash() | ||
{ | ||
$hashName = 'password_hash_' . $this->guard; | ||
$this->app['auth']->guard($this->guard)->loginUsingId('[email protected]'); | ||
$startHash = Hash::make(auth()->user()->password); | ||
$this->app['auth']->guard($this->guard)->getSession()->put($hashName, $startHash); | ||
$this->app['auth']->guard($this->guard)->quietLogout(); | ||
$this->app['auth']->guard($this->guard)->quietLogin( | ||
User::where('email', '[email protected]')->first() | ||
); | ||
$this->assertNotEquals($startHash, $this->app['auth']->guard($this->guard)->getSession()->get($hashName)); | ||
} | ||
} |