Skip to content

Commit 67b4150

Browse files
authored
Merge pull request #13 from Innovix-Matrix-Systems/IMS-36
Ims 36
2 parents 570bbad + 04bd20b commit 67b4150

2 files changed

Lines changed: 43 additions & 9 deletions

File tree

app/Services/Auth/AuthService.php

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -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
);

deploy.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash
2+
3+
# Go to the project directory
4+
5+
# Pull the latest changes from the Git repository
6+
echo Pulling latest changes ....
7+
git pull
8+
9+
# Install/update Composer dependencies
10+
echo Installing composer ....
11+
composer install --no-interaction --prefer-dist --optimize-autoloader
12+
13+
# Run database migrations (if necessary)
14+
echo Running Database Migration ....
15+
php artisan migrate --force
16+
17+
# Clear caches and optimize
18+
echo Clear optimizing the app ...
19+
php artisan optimize:clear
20+
21+
# Generate API documentation
22+
echo Generating API documentation ....
23+
php artisan scribe:generate
24+
25+
26+
#optimize the app
27+
echo Optimizing the app ...
28+
php artisan optimize
29+
30+
31+
# Optionally, trigger any other post-deployment tasks here
32+
33+
echo "Deployment script has run successfully"

0 commit comments

Comments
 (0)