Skip to content

Commit

Permalink
Merge pull request #72 from GTBitsOfGood/yash/65-fix-root-user-script
Browse files Browse the repository at this point in the history
backend fixes
  • Loading branch information
dpang314 authored Oct 28, 2023
2 parents 1d972c7 + 9298004 commit d551e4e
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions src/server/mongodb/actions/User.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,28 @@ async function deleteUser(id) {
return res;
}
async function createRootUser() {
return await User.create({
email: "[email protected]",
password: await bcrypt.hash("root", 10),
firstName: "boggers",
lastName: "boggers",
access: 2,
});
try {
const user = await User.create({
email: "[email protected]",
password: await bcrypt.hash("root", 10),
firstName: "boggers",
lastName: "boggers",
access: 2,
emailVerified: true,
});

return user;
} catch (error) {
if (error.code === 11000) {
return {
error: "Duplicate email",
};
} else {
return {
error: "Error is" + error.message,
};
}
}
}

async function createSeedUser(email, password, access) {
Expand Down

0 comments on commit d551e4e

Please sign in to comment.