fix(client-service): hide service/vm ids, mask vm password, encrypt module_vmware.password

- detail response drops id and vm.id/vmware_id, password returns *****
- GET client-service/{uuid}/vm-password returns the decrypted password to the owner
- renew accepts service uuid
- EncryptedOrLegacy cast for module_vmware.password
- vps specs: addon ram is stored in MB, convert to GB

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
baodev0
2026-10-20 15:52:56 +07:00
co-authored by Claude Sonnet 5.5
parent 66c7c0a6c3
commit 3c7710f1de
7 changed files with 57 additions and 12 deletions
@@ -194,6 +194,22 @@ class ServiceController extends Controller
]);
}
public function getVmPassword(Request $request, string $uuid)
{
$service = Service::with('vmware')
->where('uuid', $uuid)
->where('customer_id', $request->user()->id)
->first();
$vm = $service?->vmware;
if (!$vm) {
return response()->json(['error' => true, 'message' => 'Không tìm thấy dịch vụ'], 404);
}
return response()->json(['error' => false, 'data' => ['password' => $vm->plain_password]]);
}
public function getConsoleTicket(Request $request, string $uuid, vCenter $serviceVCenter)
{
$customer = $request->user();