From e230632c034b9ab49bf290a1bf745dab06726f6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20S=C3=BCdkamp?= Date: Fri, 22 Sep 2023 17:35:19 +0200 Subject: [PATCH] Fix wrong password at signup --- controllers/authController.ts | 4 ++-- dist/controllers/authController.js | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/controllers/authController.ts b/controllers/authController.ts index 4eeec09..2fe712f 100644 --- a/controllers/authController.ts +++ b/controllers/authController.ts @@ -301,9 +301,9 @@ module.exports.signup_post = async (req: any, res: any) => { res.status(201).json({ user: user._id }); } catch (err: any) { let type: string | undefined = undefined; - if (err.keyValue.id) { + if (err.keyValue?.id) { type = "userId"; - } else if (err.keyValue.email) { + } else if (err.keyValue?.email) { type = "email"; } const errors = handleSaveErrors(err, type); diff --git a/dist/controllers/authController.js b/dist/controllers/authController.js index e7ed875..6c54b23 100644 --- a/dist/controllers/authController.js +++ b/dist/controllers/authController.js @@ -232,6 +232,7 @@ module.exports.verify_email_get = (req, res) => __awaiter(void 0, void 0, void 0 * Signup by admin will not trigger e-mail verification */ module.exports.signup_post = (req, res) => __awaiter(void 0, void 0, void 0, function* () { + var _a, _b; let { email, password, passwordRepeat, firstName, // TODO: Mindestlänge 2 wg. User Id lastName, singGroup, } = req.body; try { @@ -275,10 +276,10 @@ module.exports.signup_post = (req, res) => __awaiter(void 0, void 0, void 0, fun } catch (err) { let type = undefined; - if (err.keyValue.id) { + if ((_a = err.keyValue) === null || _a === void 0 ? void 0 : _a.id) { type = "userId"; } - else if (err.keyValue.email) { + else if ((_b = err.keyValue) === null || _b === void 0 ? void 0 : _b.email) { type = "email"; } const errors = handleSaveErrors(err, type);