Disabling checkpoints



  • I'm building my module to automatically register and login users to view parts of the said module. However, I in running the command

    try {
           if($this->auth->guest()) {
            /**
             * if user email register arbitrary User
             */
            if(!$request->filled('email'))
            {
                return back()->with('error', "Please submit an email address!");
            }
    
            $user = $this->registerUser($request->only(['first_name', 'last_name', 'email']));
            $this->sentinel->bypassCheckpoints(function($sentinel)
                            {
                                return true;
                            },['activations']);
            $this->auth->loginUsingId($user->getUserId());
          }
        } catch (\Cartalyst\Sentinel\Checkpoints\NotActivatedException $e) {
            session()->flash('warning', 'You have not activated your account. Please ');
          }
    

    I still keep getting

    Cartalyst \ Sentinel \ Checkpoints \ NotActivatedException
    Your account has not been activated yet.

    at other areas of the application. Now I do not mind the checkpoint but I atleast need to be able to catch the error and return a more friendlier warning on failure. Is there a way to do a global activation check based on the route or should i disable

    'checkpoints' => [
    
            'throttle',
            // 'activation',
    
        ],
    

    the activation checkpoint and try it manually. Either way I want to be able to check for activation but want to be able to catch the exceptions and still proceed with the code.


Log in to reply
 

Looks like your connection to AsgardCms was lost, please wait while we try to reconnect.