const minisrv_service_file = true; let errpage = null; if (session_data.user_id !== 0) errpage = wtvshared.doErrorPage(400, "You are not authorized to add users to this account."); // seperate if statements as to not overwrite the first error if multiple occur if (!errpage) { if (session_data.getNumberOfUserAccounts() > minisrv_config.config.user_accounts.max_users_per_account) errpage = wtvshared.doErrorPage(400, "You are not authorized to add more than " + minisrv_config.config.user_accounts.max_users_per_account + ` account${minisrv_config.config.user_accounts.max_users_per_account > 1 ? 's' : ''}.`); } if (!errpage) { if (request_headers.query.user_password) { if (request_headers.query.user_password.length < minisrv_config.config.passwords.min_length) errpage = wtvshared.doErrorPage(400, "Your password must contain at least " + minisrv_config.config.passwords.min_length + " characters."); else if (request_headers.query.user_password.length > minisrv_config.config.passwords.max_length) errpage = wtvshared.doErrorPage(400, "Your password must contain no more than than " + minisrv_config.config.passwords.max_length + " characters."); else if (request_headers.query.user_password !== request_headers.query.user_password2) errpage = wtvshared.doErrorPage(400, "The passwords you entered did not match. Please check them and try again."); } else if (!request_headers.query.user_name) errpage = wtvshared.doErrorPage(400, "Please enter a username."); } if (errpage) { headers = errpage[0]; data = errpage[1]; } else { headers = `200 OK Connection: Keep-Alive Content-Type: text/html` data = ` Adding a user
Adding a user

You are adding ${request_headers.query.user_name}
to your account.
Display Name: ${request_headers.query.display_name || request_headers.query.user_name}
`; if ((request_headers.query.user_password) === "") { data += `No password`; } else { data += `Has password`; } data += `

`; }