@@ -234,22 +234,23 @@ protected function throwLoginError(string $errorCode): void
234234 self ::AUTH_ERROR_INCORRECT_PASSWORD => __ ('messages.login.invalid.password ' ),
235235 self ::AUTH_ERROR_INCORRECT_OTP => __ ('messages.login.invalid.otp ' ),
236236 self ::AUTH_ERROR_OTP_EXPIRED => __ ('messages.login.expired.otp ' ),
237+ self ::AUTH_ERROR_LOCKOUT => __ ('messages.login.lockout ' ),
237238 default => __ ('messages.login.fail.general ' ),
238239 };
239240
240- // Map internal error codes to ApiErrorCode if applicable, or keep specific string
241- $ apiErrorCode = match ($ errorCode ) {
242- self ::AUTH_ERROR_INCORRECT_PASSWORD => ApiErrorCode::INVALID_CREDENTIALS ->value ,
243- default => $ errorCode ,
241+ $ responseCode = match ($ errorCode ) {
242+ self ::AUTH_ERROR_INCORRECT_PASSWORD => Response::HTTP_BAD_REQUEST ,
243+ self ::AUTH_ERROR_UNVERIFIED => Response::HTTP_FORBIDDEN ,
244+ self ::AUTH_ERROR_INACTIVE => Response::HTTP_FORBIDDEN ,
245+ self ::AUTH_ERROR_LOCKOUT => Response::HTTP_LOCKED ,
246+ self ::AUTH_ERROR_OTP_EXPIRED => Response::HTTP_BAD_REQUEST ,
247+ self ::AUTH_ERROR_INCORRECT_OTP => Response::HTTP_BAD_REQUEST ,
248+ default => Response::HTTP_BAD_REQUEST ,
244249 };
245250
246- if ($ errorCode === self ::AUTH_ERROR_INCORRECT_PASSWORD ) {
247- $ responseCode = Response::HTTP_UNAUTHORIZED ;
248- }
249-
250251 throw new ApiException (
251252 $ responseCode ,
252- $ apiErrorCode ,
253+ $ errorCode ,
253254 $ errorMessage ,
254255 __ ('messages.login.fail.general ' )
255256 );
0 commit comments