Permalink
Browse files

move method

  • Loading branch information...
taylorotwell committed Mar 28, 2018
1 parent 0d3cb33 commit 9c51e49a56ff15fc47ac1a6bf232c32c25d14fd0
Showing with 21 additions and 16 deletions.
  1. +0 −16 src/Illuminate/Auth/Authenticatable.php
  2. +21 −0 src/Illuminate/Auth/SessionGuard.php
@@ -13,22 +13,6 @@
*/
protected $rememberTokenName = 'remember_token';
/**
* Invalid other sessions for the current user.
*
* The application must be using the AuthenticateSession middleware.
*
* @param string $password
* @param string $attribute
* @return $this
*/
public function logoutOtherDevices($password, $attribute = 'password')
{
return tap($this->forceFill([
$attribute => Hash::make($password)
]))->save();
}
/**
* Get the name of the unique identifier for the user.
*
@@ -4,6 +4,7 @@
use RuntimeException;
use Illuminate\Support\Str;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Traits\Macroable;
use Illuminate\Contracts\Session\Session;
use Illuminate\Contracts\Auth\UserProvider;
@@ -533,6 +534,26 @@ protected function cycleRememberToken(AuthenticatableContract $user)
$this->provider->updateRememberToken($user, $token);
}
/**
* Invalid other sessions for the current user.
*
* The application must be using the AuthenticateSession middleware.
*
* @param string $password
* @param string $attribute
* @return $this
*/
public function logoutOtherDevices($password, $attribute = 'password')
{
if (! $this->user()) {
return;
}
return tap($this->user()->forceFill([
$attribute => Hash::make($password)
]))->save();
}
/**
* Register an authentication attempt event listener.
*

0 comments on commit 9c51e49

Please sign in to comment.