/**
  * Checks the activation status of the given user.
  *
  * @param  \Cartalyst\Sentinel\Users\UserInterface  $user
  * @return bool
  * @throws \Cartalyst\Sentinel\Checkpoints\NotActivatedException
  */
 protected function checkActivation(UserInterface $user)
 {
     $completed = $this->activations->completed($user);
     if (!$completed) {
         $exception = new NotActivatedException('Your account has not been activated yet.');
         $exception->setUser($user);
         throw $exception;
     }
 }
示例#2
0
 /**
  * {@inheritDoc}
  */
 public function activate(array $data, $validate = true)
 {
     $this->rules = ['email' => 'required|email', 'activation_code' => 'required'];
     if ($validate) {
         $this->validate($data);
     }
     $user = $this->findByCredentials(['login' => $data['email']]);
     if (!$this->illuminateActivationRepository->complete($user, $data['activation_code'])) {
         throw new AuthenticationException(trans('dashboard::dashboard.errors.auth.activation.complete'));
     }
     return true;
 }
示例#3
0
 /**
  * Sweep expired codes.
  *
  * @param  ReminderRepositoryInterface|ActivationRepositoryInterface $repository
  * @param  array  $lottery
  * @return void
  */
 protected function sweep($repository, $lottery)
 {
     if ($this->hitsLottery($lottery)) {
         $repository->removeExpired();
     }
 }