Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions app/Services/Auth/AuthService.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,22 +234,23 @@ protected function throwLoginError(string $errorCode): void
self::AUTH_ERROR_INCORRECT_PASSWORD => __('messages.login.invalid.password'),
self::AUTH_ERROR_INCORRECT_OTP => __('messages.login.invalid.otp'),
self::AUTH_ERROR_OTP_EXPIRED => __('messages.login.expired.otp'),
self::AUTH_ERROR_LOCKOUT => __('messages.login.lockout'),
default => __('messages.login.fail.general'),
};

// Map internal error codes to ApiErrorCode if applicable, or keep specific string
$apiErrorCode = match ($errorCode) {
self::AUTH_ERROR_INCORRECT_PASSWORD => ApiErrorCode::INVALID_CREDENTIALS->value,
default => $errorCode,
$responseCode = match ($errorCode) {
self::AUTH_ERROR_INCORRECT_PASSWORD => Response::HTTP_BAD_REQUEST,
self::AUTH_ERROR_UNVERIFIED => Response::HTTP_FORBIDDEN,
self::AUTH_ERROR_INACTIVE => Response::HTTP_FORBIDDEN,
self::AUTH_ERROR_LOCKOUT => Response::HTTP_LOCKED,
self::AUTH_ERROR_OTP_EXPIRED => Response::HTTP_BAD_REQUEST,
self::AUTH_ERROR_INCORRECT_OTP => Response::HTTP_BAD_REQUEST,
default => Response::HTTP_BAD_REQUEST,
};

if ($errorCode === self::AUTH_ERROR_INCORRECT_PASSWORD) {
$responseCode = Response::HTTP_UNAUTHORIZED;
}

throw new ApiException(
$responseCode,
$apiErrorCode,
$errorCode,
$errorMessage,
__('messages.login.fail.general')
);
Expand Down
33 changes: 33 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

# Go to the project directory

# Pull the latest changes from the Git repository
echo Pulling latest changes ....
git pull

# Install/update Composer dependencies
echo Installing composer ....
composer install --no-interaction --prefer-dist --optimize-autoloader

# Run database migrations (if necessary)
echo Running Database Migration ....
php artisan migrate --force

# Clear caches and optimize
echo Clear optimizing the app ...
php artisan optimize:clear

# Generate API documentation
echo Generating API documentation ....
php artisan scribe:generate


#optimize the app
echo Optimizing the app ...
php artisan optimize


# Optionally, trigger any other post-deployment tasks here

echo "Deployment script has run successfully"