From 43e32b44a2203fb68ad6e87a4b613e0256fb495f Mon Sep 17 00:00:00 2001 From: DecDuck Date: Fri, 27 Dec 2024 13:14:29 +1100 Subject: [PATCH] fix(mail regex): removed global flag --- pages/admin/auth/simple/index.vue | 3 +-- pages/register.vue | 2 +- server/api/v1/auth/signup/simple.post.ts | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/pages/admin/auth/simple/index.vue b/pages/admin/auth/simple/index.vue index af9ec72..e30a4f0 100644 --- a/pages/admin/auth/simple/index.vue +++ b/pages/admin/auth/simple/index.vue @@ -382,7 +382,6 @@ import { import type { Invitation } from "@prisma/client"; import moment from "moment"; import type { SerializeObject } from "nitropack"; -import LoadingButton from "~/components/LoadingButton.vue"; definePageMeta({ layout: "admin", @@ -434,7 +433,7 @@ const email = computed({ _email.value = v; }, }); -const mailRegex = /^\S+@\S+\.\S+$/g; +const mailRegex = /^\S+@\S+\.\S+$/; const validEmail = computed(() => _email.value === undefined ? true : mailRegex.test(email.value as string) ); diff --git a/pages/register.vue b/pages/register.vue index 680aa7d..eb77710 100644 --- a/pages/register.vue +++ b/pages/register.vue @@ -208,7 +208,7 @@ const username = ref(invitation.data.value?.username); const password = ref(""); const confirmPassword = ref(undefined); -const mailRegex = /^\S+@\S+\.\S+$/g; +const mailRegex = /^\S+@\S+\.\S+$/; const validEmail = computed(() => mailRegex.test(email.value ?? "")); const validUsername = computed( () => diff --git a/server/api/v1/auth/signup/simple.post.ts b/server/api/v1/auth/signup/simple.post.ts index b19593c..a9438e8 100644 --- a/server/api/v1/auth/signup/simple.post.ts +++ b/server/api/v1/auth/signup/simple.post.ts @@ -5,7 +5,7 @@ import { v4 as uuidv4 } from "uuid"; import * as jdenticon from "jdenticon"; // Only really a simple test, in case people mistype their emails -const mailRegex = /^\S+@\S+\.\S+$/g; +const mailRegex = /^\S+@\S+\.\S+$/; export default defineEventHandler(async (h3) => { const body = await readBody(h3);