From edc390e29ec937771c23bd671f3fe54cdf9caaf2 Mon Sep 17 00:00:00 2001 From: rjsdn0 Date: Mon, 2 Dec 2024 12:16:54 +0900 Subject: [PATCH] fix: mail verification --- packages/api/src/auth/google.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/api/src/auth/google.ts b/packages/api/src/auth/google.ts index 637855f1..7a87c7df 100644 --- a/packages/api/src/auth/google.ts +++ b/packages/api/src/auth/google.ts @@ -15,9 +15,9 @@ export const gauthenticate = async (code: string): Promise => { "postmessage", ); const token = await logininfo.getToken(code); - const username = Token.parse( - jwt.decode(token.tokens.id_token!), - ).email.split("@")[0]; + const mail = Token.parse(jwt.decode(token.tokens.id_token!)).email; + const username = + mail.split("@")[1] === "sparcs.org" ? mail.split("@")[0] : null; return username; } catch { return null;