{"record":{"id":"d331fab3f48b753f","repo":"crater-invoice-inc/crater","slug":"customer-portal-not-available-for-this-user","errorCode":null,"errorMessage":"Customer portal not available for this user.","messagePattern":"Customer portal not available for this user\\.","errorType":"validation","errorClass":"ValidationException","httpStatus":422,"severity":"error","filePath":"app/Http/Controllers/V1/Customer/Auth/LoginController.php","lineNumber":34,"sourceCode":"     * Handle the incoming request.\n     *\n     * @param  \\Crater\\Http\\Requests\\Customer\\CustomerLoginRequest  $request\n     * @return \\Illuminate\\Http\\Response\n     */\n    public function __invoke(CustomerLoginRequest $request, Company $company)\n    {\n        $user = Customer::where('email', $request->email)\n            ->where('company_id', $company->id)\n            ->first();\n\n        if (! $user || ! Hash::check($request->password, $user->password)) {\n            throw ValidationException::withMessages([\n                'email' => ['The provided credentials are incorrect.'],\n            ]);\n        }\n\n        if (! $user->enable_portal) {\n            throw ValidationException::withMessages([\n                'email' => ['Customer portal not available for this user.'],\n            ]);\n        }\n\n        Auth::guard('customer')->login($user);\n\n        return response()->json([\n            'success' => true\n        ]);\n    }\n}\n","sourceCodeStart":16,"sourceCodeEnd":46,"githubUrl":"https://github.com/crater-invoice-inc/crater/blob/05d5ce26fdd8d9466009163444e944259bc0cc2a/app/Http/Controllers/V1/Customer/Auth/LoginController.php#L16-L46","documentation":"Customer portal login aborts when the authenticated customer's account does not have portal access enabled for that company — credentials may be correct but the user lacks the portal-enabled flag, so the controller refuses to issue a token/session.","triggerScenarios":"Thrown at app/Http/Controllers/V1/Customer/Auth/LoginController.php:34 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Enable the customer portal setting on the customer's company/user record before retrying login","Return a distinct, user-friendly message explaining portal access is disabled rather than a generic error","Check the portal-availability flag before the password check so an authorized-looking user gets an accurate message"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"05d5ce26fdd8d9466009163444e944259bc0cc2a","analyzedAt":"2026-09-13T09:14:24.260Z","contentChangedAt":"2026-09-13T09:14:24.260Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}