Skip to content

Commit

Permalink
Fix wrong password at signup
Browse files Browse the repository at this point in the history
  • Loading branch information
hsc-nue committed Sep 22, 2023
1 parent 74c78ba commit e230632
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions controllers/authController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 3 additions & 2 deletions dist/controllers/authController.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit e230632

Please sign in to comment.