/** * Handle * @param User $user */ public function handle(User $user) { if ($user && $user->isBanned()) { $this->guard->logout(); throw new UserIsBannedException('You are banned from the system'); } }
/** * Handle * @param User $user * @throws UserNotActivatedException */ public function handle(User $user) { if ($user && !$user->isActivated()) { $this->guard->logout(); throw new UserNotActivatedException(); } }
/** * Handle * @param User $user */ public function handle(User $user) { // Set last attempt timestamp $user->setLastLoginAt(new LastLoginAt()); $this->repository->persist($user); $this->repository->flush(); }
/** * Handle * @param User $user */ public function handle(User $user) { if ($user && $user->isSuspended()) { $this->guard->logout(); throw new UserIsSuspendedException('You are temporarily suspended. Try again later.'); } elseif ($user && $user->getSuspendedTill()) { $user->unsetSuspended(); $this->repository->persist($user); $this->repository->flush(); } }