Merge branch 'affiliate-program' of https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0 into vapor/development

This commit is contained in:
Edmond Lang
2025-12-02 01:58:17 +08:00
4 changed files with 7 additions and 18 deletions
@@ -184,7 +184,7 @@ class CreateCustomerLogic extends AbstractControllerLogic
}
// Track affiliate registration if user came from affiliate link
$this->tracksAffiliateRegistration->execute($user);
$this->tracksAffiliateRegistration->execute($user, $request->get('tracking'));
return $this->response($this->authenticationProcessor->execute($request, false));
@@ -7,6 +7,7 @@ use App\Models\User;
use App\Models\UserAffiliate;
use Illuminate\Support\Facades\Cookie;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
class TracksAffiliateRegistration
{
@@ -16,13 +17,10 @@ class TracksAffiliateRegistration
* @param User $user
* @return Affiliate|null
*/
public function execute(User $user): ?Affiliate
public function execute(User $user, string $code): ?Affiliate
{
// Get tracking code from cookie
$request = request();
$code = $request->cookie(TracksAffiliateClick::COOKIE_NAME);
if (!$code || !$this->isValidCode($code)) {
Log::info('Code is not valid', ['code' => $code]);
return null;
}
@@ -204,7 +204,9 @@
},
submitForm(){
this.step === 2 ? this.submit(this.route('api.account.registration.register'), 'post', 'registrationSection', false, false) : this.changeStep('next');
const urlParams = new URLSearchParams(window.location.search);
const tracking = urlParams.get('tracking');
this.step === 2 ? this.submit(this.route('api.account.registration.register') + (tracking ? '?tracking=' + tracking : ''), 'post', 'registrationSection', false, false) : this.changeStep('next');
}
},
mixins: [registrationFormValidation]
@@ -1,17 +1,6 @@
@extends('layouts.base_login')
@section('inner_content')
<script>
// Immediate redirect for logged-in users (before Vue loads)
// Since JWT tokens are in localStorage, server can't detect them
(function() {
const userToken = localStorage.getItem('user-token');
if (userToken && userToken.trim()) {
// User is logged in, redirect to dashboard
window.location.href = '{{ route("dashboard") }}';
}
})();
</script>
<transition-component group enter-class="animate__animated animate__fadeInRightBig animate__faster" leave-class="animate__animated animate__fadeOutRightBig">
<div class="row" key="1">
<div class="col-12 col-md p-l-0 p-r-0 p-t-15 p-b-15">