diff --git a/.env.example b/.env.example index 4aae000..1d88053 100644 --- a/.env.example +++ b/.env.example @@ -52,4 +52,4 @@ VITE_PUSHER_PORT="${PUSHER_PORT}" VITE_PUSHER_SCHEME="${PUSHER_SCHEME}" VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" -HTTP_SECURE=false +HTTPS_AWARE=false diff --git a/README.md b/README.md index be0f80e..882e404 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,15 @@ -# Laravel Template - Flowbite +# Voucher App + +This online shop to purchase wifi voucher for WISP/Small ISP Based -This just a laravel template with breeze react, user role based access crud with setup flowbite admin template ## Support me ## Requirements -- PHP 8.1 or latest -- Node 16+ or latest +- PHP 8.1 or latest +- Node 16+ or latest ## How to run @@ -32,3 +33,9 @@ password : password ```bash npm run build ``` + +## Rsync + +```bash +rsync -arP -e 'ssh -p 224' --exclude=node_modules --exclude=.git --exclude=.env --exclude=storage --exclude=public/hot . arm@ajikamaludin.id:/home/arm/projects/voucher +``` diff --git a/app/Http/Controllers/Customer/AuthController.php b/app/Http/Controllers/Customer/AuthController.php index 2204fe3..eb24631 100644 --- a/app/Http/Controllers/Customer/AuthController.php +++ b/app/Http/Controllers/Customer/AuthController.php @@ -23,8 +23,8 @@ class AuthController extends Controller public function update(Request $request) { $request->validate([ - 'username' => 'string|required|alpha_dash', - 'password' => 'string|required', + 'username' => 'required|string|alpha_dash', + 'password' => 'required|string', ]); $isAuth = Auth::guard('customer')->attempt(['username' => $request->username, 'password' => $request->password]); @@ -51,7 +51,14 @@ class AuthController extends Controller public function callback_google() { - $user = Socialite::driver('google')->user(); + $config = new Config( + env('GOOGLE_CLIENT_ID'), + env('GOOGLE_CLIENT_SECRET'), + route('customer.login.callback_google') + ); + $user = Socialite::driver('google') + ->setConfig($config) + ->user(); $customer = Customer::where('google_id', $user->id)->first(); if ($customer == null) { DB::beginTransaction(); @@ -87,12 +94,12 @@ class AuthController extends Controller public function store(Request $request) { $request->validate([ - 'fullname' => 'string|required', - 'name' => 'string|required', - 'address' => 'string|required', - 'phone' => 'string|required|numeric', - 'username' => 'string|required|min:5|alpha_dash|unique:customers,username', - 'password' => 'string|required|min:8|confirmed', + 'fullname' => 'required|string', + 'name' => 'required|string', + 'address' => 'required|string', + 'phone' => 'required|string|numeric', + 'username' => 'required|string|min:5|alpha_dash|unique:customers,username', + 'password' => 'required|string|min:8|confirmed', ]); DB::beginTransaction(); diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index 968e27d..68242dd 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -69,5 +69,6 @@ class Kernel extends HttpKernel 'inertia.admin' => \App\Http\Middleware\HandleInertiaRequests::class, 'inertia.customer' => \App\Http\Middleware\HandleInertiaCustomerRequests::class, 'guard_should_customer' => \App\Http\Middleware\GuardCustomer::class, + 'http_secure_aware' => \App\Http\Middleware\HttpSecureAware::class, ]; } diff --git a/app/Http/Middleware/HandleInertiaCustomerRequests.php b/app/Http/Middleware/HandleInertiaCustomerRequests.php index 9579dbd..6f46927 100644 --- a/app/Http/Middleware/HandleInertiaCustomerRequests.php +++ b/app/Http/Middleware/HandleInertiaCustomerRequests.php @@ -31,7 +31,7 @@ class HandleInertiaCustomerRequests extends Middleware { return array_merge(parent::share($request), [ 'auth' => [ - 'user' => auth('customer')->user()->load(['level']), + 'user' => auth('customer')->user()?->load(['level']), ], 'flash' => [ 'message' => fn () => $request->session()->get('message') ?? ['type' => null, 'message' => null], diff --git a/resources/js/Layouts/CustomerLayout.jsx b/resources/js/Layouts/CustomerLayout.jsx index 17bd3f0..dd8557a 100644 --- a/resources/js/Layouts/CustomerLayout.jsx +++ b/resources/js/Layouts/CustomerLayout.jsx @@ -26,49 +26,47 @@ export default function CustomerLayout({ children }) { } return ( -