Skip to content

Commit

Permalink
[fix] Election registration checking in Vote verification
Browse files Browse the repository at this point in the history
Signed-off-by: TechQuery <shiy2008@gmail.com>
  • Loading branch information
TechQuery committed Jan 25, 2025
1 parent 966b5dc commit 7ccd6b1
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/controller/Election.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class ElectionController {
await lark.getAccessToken();

const [formalMember] = await new MemberBiDataTable().getList({
手机号: mobilePhone,
手机号: mobilePhone.replace(/^\+86-?/, ''),
formalMember: true
});
if (!formalMember)
Expand All @@ -74,6 +74,13 @@ export class ElectionController {
@Param('electionName') electionName: string,
@Body() { publicKey, signature }: VoteTicket
) {
const registration = await this.publicKeyStore.findOneBy({
electionName,
jsonWebKey: publicKey
});
if (!registration)
return { electionName, publicKey, signature, verified: false };

const key = await crypto.subtle.importKey(
'jwk',
JSON.parse(atob(publicKey)),
Expand Down

0 comments on commit 7ccd6b1

Please sign in to comment.