diff --git a/Client/src/Pages/Auth/Register/Register.jsx b/Client/src/Pages/Auth/Register/Register.jsx index eb331304c..c9f61adae 100644 --- a/Client/src/Pages/Auth/Register/Register.jsx +++ b/Client/src/Pages/Auth/Register/Register.jsx @@ -596,7 +596,7 @@ const Register = ({ isSuperAdmin }) => { let registerForm = { ...form, role: isSuperAdmin ? ["superadmin"] : form.role, - inviteToken: token ? token : "", + inviteToken: token ? token : "", // Add the token to the request for verification }; let error = validateForm(registerForm, { context: { password: form.password }, diff --git a/Server/controllers/authController.js b/Server/controllers/authController.js index 6357d25de..4e589ac8a 100644 --- a/Server/controllers/authController.js +++ b/Server/controllers/authController.js @@ -52,6 +52,7 @@ const registerController = async (req, res, next) => { // Create a new user try { const { inviteToken } = req.body; + // If superAdmin exists, a token should be attached to all further register requests const superAdminExists = await req.db.checkSuperadmin(req, res); if (superAdminExists) { await req.db.getInviteTokenAndDelete(inviteToken); diff --git a/Server/db/mongo/modules/inviteModule.js b/Server/db/mongo/modules/inviteModule.js index 1b7d698cd..9a0d35621 100644 --- a/Server/db/mongo/modules/inviteModule.js +++ b/Server/db/mongo/modules/inviteModule.js @@ -42,7 +42,6 @@ const requestInviteToken = async (userData) => { * @throws {Error} If the invite token is not found or there is another error. */ const getInviteToken = async (token) => { - console.log(token); try { const invite = await InviteToken.findOne({ token,