From 267e85b891fe7058d094abce9511792147017f79 Mon Sep 17 00:00:00 2001 From: Jake Fulmine Date: Mon, 22 Aug 2022 10:01:07 +0200 Subject: [PATCH] feat(dashboard): trim all user-submitted strings --- dashboard/src/lib/group/Edit.svelte | 3 +++ dashboard/src/lib/group/NewGroup.svelte | 3 +++ dashboard/src/lib/member/Edit.svelte | 3 +++ dashboard/src/lib/member/NewMember.svelte | 3 +++ dashboard/src/lib/system/Edit.svelte | 3 +++ 5 files changed, 15 insertions(+) diff --git a/dashboard/src/lib/group/Edit.svelte b/dashboard/src/lib/group/Edit.svelte index 8aebf004..01cf4482 100644 --- a/dashboard/src/lib/group/Edit.svelte +++ b/dashboard/src/lib/group/Edit.svelte @@ -36,6 +36,9 @@ } } + // trim all string fields + Object.keys(data).forEach(k => data[k] = typeof data[k] == "string" ? data[k].trim() : data[k]); + err = err; if (err.length > 0) return; diff --git a/dashboard/src/lib/group/NewGroup.svelte b/dashboard/src/lib/group/NewGroup.svelte index f9fef97a..f04eec80 100644 --- a/dashboard/src/lib/group/NewGroup.svelte +++ b/dashboard/src/lib/group/NewGroup.svelte @@ -45,6 +45,9 @@ } } + // trim all string fields + Object.keys(data).forEach(k => data[k] = typeof data[k] == "string" ? data[k].trim() : data[k]); + err = err; if (err.length > 0) return; diff --git a/dashboard/src/lib/member/Edit.svelte b/dashboard/src/lib/member/Edit.svelte index 43441eba..058fbc5c 100644 --- a/dashboard/src/lib/member/Edit.svelte +++ b/dashboard/src/lib/member/Edit.svelte @@ -60,6 +60,9 @@ } } + // trim all string fields + Object.keys(data).forEach(k => data[k] = typeof data[k] == "string" ? data[k].trim() : data[k]); + err = err; if (err.length > 0) return; diff --git a/dashboard/src/lib/member/NewMember.svelte b/dashboard/src/lib/member/NewMember.svelte index 4d30496f..a8ec1345 100644 --- a/dashboard/src/lib/member/NewMember.svelte +++ b/dashboard/src/lib/member/NewMember.svelte @@ -83,6 +83,9 @@ } } + // trim all string fields + Object.keys(data).forEach(k => data[k] = typeof data[k] == "string" ? data[k].trim() : data[k]); + err = err; if (err.length > 0) return; diff --git a/dashboard/src/lib/system/Edit.svelte b/dashboard/src/lib/system/Edit.svelte index 0b983549..2f0b845e 100644 --- a/dashboard/src/lib/system/Edit.svelte +++ b/dashboard/src/lib/system/Edit.svelte @@ -34,6 +34,9 @@ err.push(`"${data.timezone}" is not a valid timezone, check out this site to see your current timezone!`); } */ + // trim all string fields + Object.keys(data).forEach(k => data[k] = typeof data[k] == "string" ? data[k].trim() : data[k]); + err = err; if (err.length > 0) return;