From 3e61c801fc3ca9644304c88f86adf5aa297aeef4 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 30 Aug 2021 17:49:03 -0700 Subject: strip spaces from usernames --- lib/utils.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'lib/utils.js') diff --git a/lib/utils.js b/lib/utils.js index 23c811c1..8e857659 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -6,10 +6,12 @@ getUser = async (username, transaction) => { include: [ { model: db.Account, - as: "account" - } + as: "account", + }, ], - where: { username } + where: { + username: { [Op.or]: [username, username.replace(/ /g, "")] }, + }, }; if (transaction) { @@ -28,10 +30,10 @@ getUserById = async (id, transaction) => { include: [ { model: db.Account, - as: "account" - } + as: "account", + }, ], - where: { id } + where: { id }, }; if (transaction) { -- cgit v1.2.3