diff --git a/solvway-admin-portal/app/components/events/RegistrationQrCard.test.tsx b/solvway-admin-portal/app/components/events/RegistrationQrCard.test.tsx
index 152b342..a470090 100644
--- a/solvway-admin-portal/app/components/events/RegistrationQrCard.test.tsx
+++ b/solvway-admin-portal/app/components/events/RegistrationQrCard.test.tsx
@@ -1,19 +1,25 @@
import { describe, it, expect, vi, beforeEach } from "vitest";
import { render, screen, waitFor } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
+import { forwardRef } from "react";
const mocks = vi.hoisted(() => ({ getEventLinks: vi.fn(), setLinkEnabled: vi.fn() }));
vi.mock("@/app/lib/services/adminRegistration", () => mocks);
vi.mock("qrcode.react", () => ({
QRCodeSVG: ({ value }: { value: string }) => ,
- QRCodeCanvas: () => ,
+ QRCodeCanvas: forwardRef(function QRCodeCanvas(_, ref) {
+ return ;
+ }),
}));
import { RegistrationQrCard } from "./RegistrationQrCard";
const links = {
event: { token: "ev1", enabled: true },
- members: [{ userId: 5, name: "Aini", token: "m1", enabled: false }],
+ members: [
+ { userId: 5, name: "Aini", username: "aini@cv", token: "m1", enabled: false },
+ { userId: 6, name: "Bob", username: "", token: "m2", enabled: true },
+ ],
};
beforeEach(() => {
@@ -24,24 +30,43 @@ beforeEach(() => {
describe("RegistrationQrCard", () => {
it("lists the event code and each team member code with a QR", async () => {
render();
- await screen.findByText("Aini");
+ await screen.findByText("Aini (aini@cv)");
const values = screen.getAllByTestId("qr-svg").map((e) => e.getAttribute("data-value"));
- expect(values).toEqual([`${window.location.origin}/r/ev1`, `${window.location.origin}/r/m1`]);
+ expect(values).toEqual([`${window.location.origin}/r/ev1`, `${window.location.origin}/r/m1`, `${window.location.origin}/r/m2`]);
expect(screen.getByText(/dynamic-qr/)).toBeTruthy();
expect(mocks.getEventLinks).toHaveBeenCalledWith("u1");
});
+ it("labels a member without a username by name only", async () => {
+ render();
+ await screen.findByText("Bob");
+ expect(screen.queryByText(/\(\)/)).toBeNull();
+ });
+
+ it("names the PNG download after the event and the member's name and username", async () => {
+ const user = userEvent.setup();
+ const names: string[] = [];
+ vi.spyOn(HTMLCanvasElement.prototype, "toDataURL").mockReturnValue("data:image/png;base64,");
+ vi.spyOn(HTMLAnchorElement.prototype, "click").mockImplementation(function (this: HTMLAnchorElement) {
+ names.push(this.download);
+ });
+ render();
+ await screen.findByText("Aini (aini@cv)");
+ await user.click(screen.getAllByRole("button", { name: "Download PNG" })[1]);
+ expect(names).toEqual(["expo-aini-aini-cv-qr.png"]);
+ });
+
it("toggles a code through the API", async () => {
const user = userEvent.setup();
render();
- await screen.findByText("Aini");
+ await screen.findByText("Aini (aini@cv)");
await user.click(screen.getAllByRole("switch")[1]);
await waitFor(() => expect(mocks.setLinkEnabled).toHaveBeenCalledWith("u1", "m1", true));
});
it("hides the switches without write access", async () => {
render();
- await screen.findByText("Aini");
+ await screen.findByText("Aini (aini@cv)");
expect(screen.queryAllByRole("switch")).toHaveLength(0);
});
});
diff --git a/solvway-admin-portal/app/components/events/RegistrationQrCard.tsx b/solvway-admin-portal/app/components/events/RegistrationQrCard.tsx
index 4aaf62a..45b07ab 100644
--- a/solvway-admin-portal/app/components/events/RegistrationQrCard.tsx
+++ b/solvway-admin-portal/app/components/events/RegistrationQrCard.tsx
@@ -50,9 +50,12 @@ export function RegistrationQrCard({ eventUuid, eventName, canWrite }: { eventUu
{links && (
<>
- {links.members.map((m) => (
-
- ))}
+ {links.members.map((m) => {
+ const label = m.username ? `${m.name} (${m.username})` : m.name;
+ return (
+
+ );
+ })}
>
)}
diff --git a/solvway-admin-portal/app/lib/i18n/defaultMessages.ts b/solvway-admin-portal/app/lib/i18n/defaultMessages.ts
index d9964af..43e065b 100644
--- a/solvway-admin-portal/app/lib/i18n/defaultMessages.ts
+++ b/solvway-admin-portal/app/lib/i18n/defaultMessages.ts
@@ -474,7 +474,8 @@ export const DEFAULT_MESSAGES: Record = {
RegInterests: "Interests (optional)",
RegNoticeEn: "English",
RegNoticeMs: "Bahasa Malaysia",
- RegConsent: "I have read the notice and agree",
+ RegConsentEn: "I agree to {company} using my details as described above.",
+ RegConsentMs: "Saya bersetuju {company} menggunakan butiran saya seperti yang diterangkan di atas.",
RegSubmit: "Register",
RegAnother: "Register another person",
RegThanks: "Thank you, you're registered for {event}",
diff --git a/solvway-admin-portal/app/lib/services/adminRegistration.ts b/solvway-admin-portal/app/lib/services/adminRegistration.ts
index 55ed24f..4e3ef57 100644
--- a/solvway-admin-portal/app/lib/services/adminRegistration.ts
+++ b/solvway-admin-portal/app/lib/services/adminRegistration.ts
@@ -6,7 +6,7 @@ export interface RegistrationLink {
}
export interface EventLinks {
event: RegistrationLink;
- members: (RegistrationLink & { userId: number; name: string })[];
+ members: (RegistrationLink & { userId: number; name: string; username: string })[];
}
export interface MyLink extends RegistrationLink {
eventUuid: string;
diff --git a/solvway-admin-portal/app/r/[token]/page.test.tsx b/solvway-admin-portal/app/r/[token]/page.test.tsx
index ba66971..13ce370 100644
--- a/solvway-admin-portal/app/r/[token]/page.test.tsx
+++ b/solvway-admin-portal/app/r/[token]/page.test.tsx
@@ -40,6 +40,13 @@ describe("/r/[token] public page", () => {
expect(mocks.getRegistration).toHaveBeenCalledWith("tok1");
});
+ it("shows the consent tick box text in English and Bahasa Malaysia with the company name", async () => {
+ await ready();
+ const box = screen.getByRole("checkbox", { name: /I agree to INS using my details as described above\./ });
+ expect(box).toBeTruthy();
+ expect(screen.getByText("Saya bersetuju INS menggunakan butiran saya seperti yang diterangkan di atas.")).toBeTruthy();
+ });
+
it("shows only the inactive message, no event details, when the code is off", async () => {
mocks.getRegistration.mockRejectedValue(new ApiError("x", 404, { code: "CODE_INACTIVE" }));
render();
@@ -65,7 +72,7 @@ describe("/r/[token] public page", () => {
await user.type(screen.getByLabelText("Company"), "Acme");
await user.type(screen.getByLabelText("Job title"), "Buyer");
await user.click(screen.getByLabelText("Wellness"));
- await user.click(screen.getByLabelText("I have read the notice and agree"));
+ await user.click(screen.getByLabelText(/I agree to INS using my details as described above\./));
await user.click(screen.getByRole("button", { name: "Register" }));
await screen.findByText("Thank you, you're registered for Expo 2026");
expect(mocks.submitRegistration).toHaveBeenCalledWith("tok1", {
@@ -75,7 +82,7 @@ describe("/r/[token] public page", () => {
await user.click(screen.getByRole("button", { name: "Register another person" }));
const name = (await screen.findByLabelText("Your name")) as HTMLInputElement;
expect(name.value).toBe("");
- expect((screen.getByLabelText("I have read the notice and agree") as HTMLElement).getAttribute("aria-checked")).toBe("false");
+ expect((screen.getByLabelText(/I agree to INS using my details as described above\./) as HTMLElement).getAttribute("aria-checked")).toBe("false");
expect((screen.getByLabelText("Wellness") as HTMLElement).getAttribute("aria-checked")).toBe("false");
expect((document.querySelector('input[name="website"]') as HTMLInputElement).value).toBe("");
});
@@ -111,7 +118,7 @@ describe("/r/[token] public page", () => {
await user.type(screen.getByLabelText("Email"), "a@b.co");
await user.click(screen.getByRole("button", { name: "Register" }));
const msg = await screen.findByText("Consent is required.");
- const box = screen.getByLabelText("I have read the notice and agree");
+ const box = screen.getByLabelText(/I agree to INS using my details as described above\./);
expect(box.getAttribute("aria-describedby")).toBe(msg.id);
expect(box.getAttribute("aria-invalid")).toBe("true");
});
@@ -142,7 +149,7 @@ describe("/r/[token] public page", () => {
await ready();
expect(screen.getByLabelText("Your name").className).toContain("h-11");
expect(screen.getByRole("button", { name: "Register" }).className).toContain("h-11");
- for (const l of ["Wellness", "I have read the notice and agree"]) {
+ for (const l of ["Wellness", /I agree to INS using my details/]) {
const label = document.querySelector(`label[for="${screen.getByLabelText(l).id}"]`)!;
expect(label.className).toContain("w-full");
expect(label.className).toContain("min-h-11");
@@ -155,7 +162,7 @@ describe("/r/[token] public page", () => {
await ready();
await user.type(screen.getByLabelText("Your name"), "Aini");
await user.type(screen.getByLabelText("Email"), "a@b.co");
- await user.click(screen.getByLabelText("I have read the notice and agree"));
+ await user.click(screen.getByLabelText(/I agree to INS using my details as described above\./));
await user.click(screen.getByRole("button", { name: "Register" }));
await screen.findByText("Too many registrations from this device. Try again later.");
mocks.submitRegistration.mockRejectedValueOnce(new ApiError("x", 404, { code: "CODE_INACTIVE" }));
diff --git a/solvway-admin-portal/app/r/[token]/page.tsx b/solvway-admin-portal/app/r/[token]/page.tsx
index 189103c..c7bb737 100644
--- a/solvway-admin-portal/app/r/[token]/page.tsx
+++ b/solvway-admin-portal/app/r/[token]/page.tsx
@@ -151,7 +151,10 @@ export default function RegisterPage() {
{errors.consent && {errors.consent}
}
{/* Honeypot: people never see or reach it; bots fill it and the server drops the submission. */}
diff --git a/solvway-mobile-api/src/main/java/com/solvway/mobile/api/service/RegistrationLinkService.java b/solvway-mobile-api/src/main/java/com/solvway/mobile/api/service/RegistrationLinkService.java
index 9eee59f..c8a0443 100644
--- a/solvway-mobile-api/src/main/java/com/solvway/mobile/api/service/RegistrationLinkService.java
+++ b/solvway-mobile-api/src/main/java/com/solvway/mobile/api/service/RegistrationLinkService.java
@@ -59,6 +59,7 @@ public class RegistrationLinkService {
Map m = new LinkedHashMap<>();
m.put("userId", id.longValue());
m.put("name", u == null ? String.valueOf(id) : String.valueOf(u.get("name")));
+ m.put("username", u == null || u.get("username") == null ? "" : String.valueOf(u.get("username")));
m.put("token", row.get("token"));
m.put("enabled", row.get("enabled"));
members.add(m);
diff --git a/solvway-mobile-api/src/test/java/com/solvway/mobile/api/service/RegistrationLinkServiceTest.java b/solvway-mobile-api/src/test/java/com/solvway/mobile/api/service/RegistrationLinkServiceTest.java
index 817bd44..dbf8bca 100644
--- a/solvway-mobile-api/src/test/java/com/solvway/mobile/api/service/RegistrationLinkServiceTest.java
+++ b/solvway-mobile-api/src/test/java/com/solvway/mobile/api/service/RegistrationLinkServiceTest.java
@@ -78,7 +78,7 @@ class RegistrationLinkServiceTest {
void close() { http.close(); }
private void stubUser(long id, String name) {
- Map u = new HashMap<>(Map.of("id", id, "name", name, "type", "A", "companyId", COMPANY, "enabled", true));
+ Map u = new HashMap<>(Map.of("id", id, "name", name, "username", "sales" + id, "type", "A", "companyId", COMPANY, "enabled", true));
when(rest.getForEntity(eq(USER), any(ParameterizedTypeReference.class), eq(id))).thenReturn(ResponseEntity.ok(u));
}
@@ -100,11 +100,23 @@ class RegistrationLinkServiceTest {
assertThat((Map) out.get("event")).containsEntry("token", "ev1").containsEntry("enabled", true);
assertThat((List