Skip to content

A continuation of HomeBox the inventory and organization system built for the Home User

adding email validator (#178)

Romulo Gatto1688773bba3b
diff --git a/frontend/pages/index.vue b/frontend/pages/index.vue
index d678ef05..895ceddc 100644
--- a/frontend/pages/index.vue
+++ b/frontend/pages/index.vue
@@ -77,6 +77,15 @@
async function registerUser() {
loading.value = true;
+
+ const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
+
+ if (!emailRegex.test(email.value)) {
+ toast.error("Invalid email address");
+ loading.value = false;
+ return;
+ }
+
const { error } = await api.register({
name: username.value,
email: email.value,