Skip to content

Commit 2f3592a

Browse files
authored
feat: charter signature verification error display (#317)
1 parent fc5bca6 commit 2f3592a

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

platforms/group-charter-manager-api/src/controllers/CharterSigningController.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ export class CharterSigningController {
9494
res.write(`data: ${JSON.stringify({ type: "expired" })}\n\n`);
9595
clearInterval(interval);
9696
res.end();
97+
} else if (session.status === "security_violation") {
98+
res.write(`data: ${JSON.stringify({ type: "security_violation" })}\n\n`);
99+
clearInterval(interval);
100+
res.end();
97101
}
98102
} else {
99103
res.write(`data: ${JSON.stringify({ type: "error", message: "Session not found" })}\n\n`);

platforms/group-charter-manager/src/components/charter-signing-interface.tsx

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ interface CharterSigningInterfaceProps {
2222
export function CharterSigningInterface({ groupId, charterData, onSigningComplete, onCancel, onSigningStatusUpdate }: CharterSigningInterfaceProps) {
2323
const [sessionId, setSessionId] = useState<string | null>(null);
2424
const [qrData, setQrData] = useState<string | null>(null);
25-
const [status, setStatus] = useState<"pending" | "connecting" | "signed" | "expired" | "error">("pending");
25+
const [status, setStatus] = useState<"pending" | "connecting" | "signed" | "expired" | "error" | "security_violation">("pending");
2626
const [timeRemaining, setTimeRemaining] = useState<number>(900); // 15 minutes in seconds
2727
const [eventSource, setEventSource] = useState<EventSource | null>(null);
2828
const { toast } = useToast();
@@ -108,6 +108,13 @@ export function CharterSigningInterface({ groupId, charterData, onSigningComplet
108108
description: "The signing session has expired. Please try again.",
109109
variant: "destructive",
110110
});
111+
} else if (data.type === "security_violation") {
112+
setStatus("security_violation");
113+
toast({
114+
title: "eName Verification Failed",
115+
description: "eName verification failed. Please check your eID.",
116+
variant: "destructive",
117+
});
111118
} else {
112119
console.log("SSE message:", data);
113120
}
@@ -254,6 +261,31 @@ export function CharterSigningInterface({ groupId, charterData, onSigningComplet
254261
);
255262
}
256263

264+
if (status === "security_violation") {
265+
return (
266+
<Card className="w-full max-w-md mx-auto">
267+
<CardHeader className="text-center">
268+
<CardTitle className="flex items-center justify-center gap-2">
269+
<AlertTriangle className="h-5 w-5 text-red-500" />
270+
eName verification failed
271+
</CardTitle>
272+
<CardDescription>
273+
eName verification failed
274+
</CardDescription>
275+
</CardHeader>
276+
<CardContent className="text-center space-y-4">
277+
<div className="bg-red-50 p-4 rounded-lg">
278+
<p className="text-red-800 text-sm">
279+
eName Mismatch: It appears that you are trying to sign with the wrong eName.
280+
Please make sure you are signing with the right eID linked to this account.
281+
</p>
282+
</div>
283+
<Button onClick={onCancel} variant="secondary">Close</Button>
284+
</CardContent>
285+
</Card>
286+
);
287+
}
288+
257289
return (
258290
<Card className="w-full max-w-md mx-auto">
259291
<CardHeader className="text-center">

0 commit comments

Comments
 (0)