/**
  * Once the user is authenticated...
  *
  * @param Request $request
  * @param         $user
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 protected function authenticated(Request $request, $user)
 {
     $activationService = new UserActivationService();
     if (!$user->active) {
         // check if token is expired and resend a new one if so
         $resent = $activationService->checkToken($user);
         // $resent will return false if token has expired
         // otherwise will tell us how long ago the activation email was sent.
         $message = $resent ? trans('activation.registration.email_sent', ['when' => $resent]) : trans('activation.registration.email_resent');
         // we don't want a yet non-active User logging in now, do we?
         Auth::logout();
         $response = ['process' => 'login', 'success' => false, 'alert' => 'alert-warning', 'message' => $message];
         if ($request->ajax()) {
             return response()->json(['auth_status' => $response], 200);
         }
         return back()->with('auth_status', $response);
     }
     $response = ['process' => 'login', 'success' => true, 'alert' => 'alert-success', 'message' => trans('activation.registration.login_success')];
     if ($request->ajax()) {
         return response()->json(['auth_status' => $response], 200);
     }
     return redirect()->intended('/')->with('auth_status', $response);
 }
 /**
  * @param $user
  */
 public function created($user)
 {
     $this->activationService->createActivation($user);
 }