add comments

This commit is contained in:
Alex Holliday
2024-09-25 15:14:22 +08:00
parent 5dbd8378e2
commit ffd193437e
3 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -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 },
+1
View File
@@ -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);
-1
View File
@@ -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,