Adding logUserIn method to log a user object in

parent 28c54394
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
namespace Modules\User\Contracts; namespace Modules\User\Contracts;
use Cartalyst\Sentinel\Users\UserInterface;
interface Authentication interface Authentication
{ {
/** /**
...@@ -88,4 +90,11 @@ interface Authentication ...@@ -88,4 +90,11 @@ interface Authentication
* @return int * @return int
*/ */
public function id(); public function id();
/**
* Log a user manually in
* @param UserInterface $user
* @return UserInterface
*/
public function logUserIn(UserInterface $user) : UserInterface;
} }
...@@ -7,6 +7,7 @@ use Cartalyst\Sentinel\Checkpoints\ThrottlingException; ...@@ -7,6 +7,7 @@ use Cartalyst\Sentinel\Checkpoints\ThrottlingException;
use Cartalyst\Sentinel\Laravel\Facades\Activation; use Cartalyst\Sentinel\Laravel\Facades\Activation;
use Cartalyst\Sentinel\Laravel\Facades\Reminder; use Cartalyst\Sentinel\Laravel\Facades\Reminder;
use Cartalyst\Sentinel\Laravel\Facades\Sentinel; use Cartalyst\Sentinel\Laravel\Facades\Sentinel;
use Cartalyst\Sentinel\Users\UserInterface;
use Modules\User\Contracts\Authentication; use Modules\User\Contracts\Authentication;
use Modules\User\Events\UserHasActivatedAccount; use Modules\User\Events\UserHasActivatedAccount;
...@@ -169,4 +170,9 @@ class SentinelAuthentication implements Authentication ...@@ -169,4 +170,9 @@ class SentinelAuthentication implements Authentication
return $user->id; return $user->id;
} }
public function logUserIn(UserInterface $user) : UserInterface
{
return Sentinel::login($user);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment