/**
  * Do login authentication
  *
  * @param CreateAuthRequest $request
  * @return $this|\Illuminate\Http\RedirectResponse
  */
 public function doLogin(CreateAuthRequest $request)
 {
     $credentials = $request->only('email', 'password');
     if ($this->auth->attempt($credentials, true)) {
         return redirect()->route('admin.dashboard');
     }
     return redirect()->back()->withErrors(['general' => 'Invalid username or password!']);
 }
 /**
  * Do password authentication
  *
  * @param CreateAuthRequest $request
  * @return JsonResponse
  */
 public function auth(CreateAuthRequest $request)
 {
     $credentials = $request->only(['email', 'password']);
     $isOk = $this->auth->attempt($credentials, true);
     if (!$isOk) {
         return $this->respondWithError(__('Invalid username or password!'), 404);
     }
     $user = $this->auth->user();
     if ($user->status == 0) {
         $this->auth->logout($user);
         return $this->respondWithError(__('Your account is not confirmed!'));
     }
     if ($user->blocked == 1) {
         $this->auth->logout($user);
         return $this->respondWithError(__('Your account is blocked!'));
     }
     return new JsonResponse();
 }