Skip to content

Commit

Permalink
Adding logUserIn method to log a user object in
Browse files Browse the repository at this point in the history
  • Loading branch information
nWidart committed Sep 16, 2017
1 parent 28c5439 commit 4e6d38c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Modules/User/Contracts/Authentication.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Modules\User\Contracts;

use Cartalyst\Sentinel\Users\UserInterface;

interface Authentication
{
/**
Expand Down Expand Up @@ -88,4 +90,11 @@ public function user();
* @return int
*/
public function id();

/**
* Log a user manually in
* @param UserInterface $user
* @return UserInterface
*/
public function logUserIn(UserInterface $user) : UserInterface;
}
6 changes: 6 additions & 0 deletions Modules/User/Repositories/Sentinel/SentinelAuthentication.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Cartalyst\Sentinel\Laravel\Facades\Activation;
use Cartalyst\Sentinel\Laravel\Facades\Reminder;
use Cartalyst\Sentinel\Laravel\Facades\Sentinel;
use Cartalyst\Sentinel\Users\UserInterface;
use Modules\User\Contracts\Authentication;
use Modules\User\Events\UserHasActivatedAccount;

Expand Down Expand Up @@ -169,4 +170,9 @@ public function id()

return $user->id;
}

public function logUserIn(UserInterface $user) : UserInterface
{
return Sentinel::login($user);
}
}

0 comments on commit 4e6d38c

Please sign in to comment.