setActivationRepository() public method

Sets the activations repository.
public setActivationRepository ( Cartalyst\Sentinel\Activations\ActivationRepositoryInterface $activations ) : void
$activations Cartalyst\Sentinel\Activations\ActivationRepositoryInterface
return void
Ejemplo n.º 1
0
 /**
  * Creates a sentinel instance.
  *
  * @return \Cartalyst\Sentinel\Sentinel
  */
 public function createSentinel()
 {
     $persistence = $this->createPersistence();
     $users = $this->createUsers();
     $roles = $this->createRoles();
     $activations = $this->createActivations();
     $dispatcher = $this->getEventDispatcher();
     $sentinel = new Sentinel($persistence, $users, $roles, $activations, $dispatcher);
     $ipAddress = $this->getIpAddress();
     $checkpoints = $this->createCheckpoints($activations, $ipAddress);
     foreach ($checkpoints as $key => $checkpoint) {
         $sentinel->addCheckpoint($key, $checkpoint);
     }
     $reminders = $this->createReminders($users);
     $sentinel->setActivationRepository($activations);
     $sentinel->setReminderRepository($reminders);
     return $sentinel;
 }
Ejemplo n.º 2
0
 /**
  * Sets the activations repository.
  *
  * @param \Cartalyst\Sentinel\Activations\ActivationRepositoryInterface $activations
  * @return void 
  * @static 
  */
 public static function setActivationRepository($activations)
 {
     \Cartalyst\Sentinel\Sentinel::setActivationRepository($activations);
 }
 /**
  * Registers sentinel.
  *
  * @return void
  */
 protected function registerSentinel()
 {
     $this->app->singleton('sentinel', function ($app) {
         $sentinel = new Sentinel($app['sentinel.persistence'], $app['sentinel.users'], $app['sentinel.roles'], $app['sentinel.activations'], $app['events']);
         if (isset($app['sentinel.checkpoints'])) {
             foreach ($app['sentinel.checkpoints'] as $key => $checkpoint) {
                 $sentinel->addCheckpoint($key, $checkpoint);
             }
         }
         $sentinel->setActivationRepository($app['sentinel.activations']);
         $sentinel->setReminderRepository($app['sentinel.reminders']);
         $sentinel->setRequestCredentials(function () use($app) {
             $request = $app['request'];
             $login = $request->getUser();
             $password = $request->getPassword();
             if ($login === null && $password === null) {
                 return;
             }
             return compact('login', 'password');
         });
         $sentinel->creatingBasicResponse(function () {
             $headers = ['WWW-Authenticate' => 'Basic'];
             return new Response('Invalid credentials.', 401, $headers);
         });
         return $sentinel;
     });
     $this->app->alias('sentinel', 'Cartalyst\\Sentinel\\Sentinel');
 }