Skip to content
Open
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
17 changes: 3 additions & 14 deletions core/components/minishop3/src/Controllers/Customer/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -428,12 +428,9 @@ public function getOrCreate(?array $orderData = null): int
$email = $orderData['address_email'] ?? '';

if (!empty($email)) {
// Link order to existing account by email only.
// Never overwrite msCustomer.token — that hands the guest session the victim's account.
$msCustomer = $this->findByEmail($email);

if ($msCustomer) {
$msCustomer->set('token', $this->token);
$msCustomer->save();
}
}

if (empty($msCustomer)) {
Expand Down Expand Up @@ -555,16 +552,8 @@ protected function createFromOrderData(array $orderData): ?msCustomer
$this->autoLoginCustomer($msCustomer);
}
} else {
// Email already registered: attach order only — no token/session takeover
$msCustomer = $this->findByEmail($email);

if ($msCustomer) {
$msCustomer->set('token', $this->token);
$msCustomer->save();

if ($autoLogin) {
$this->autoLoginCustomer($msCustomer);
}
}
}
}
}
Expand Down