From 7d090d059b08ad891a2ae2b3a92b5696de0d05e8 Mon Sep 17 00:00:00 2001 From: Phillip Thelen Date: Wed, 9 Feb 2022 13:55:14 +0100 Subject: [PATCH] fix error --- website/server/libs/auth/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/server/libs/auth/index.js b/website/server/libs/auth/index.js index 6c15569276..698a1d9180 100644 --- a/website/server/libs/auth/index.js +++ b/website/server/libs/auth/index.js @@ -128,7 +128,7 @@ async function registerLocal (req, res, { isV3 = false }) { }, { 'auth.local': 1 }).exec(); if (user) { - if (user._id !== existingUser._id) { + if (existingUser && user._id !== existingUser._id) { if (email === user.auth.local.email) throw new NotAuthorized(res.t('emailTaken')); // Check that the lowercase username isn't already used if (existingUser) {