fix adding users

This commit is contained in:
zefie
2022-10-22 21:30:19 -04:00
parent 0bb95df5dc
commit e507672c27
4 changed files with 8 additions and 5 deletions

View File

@@ -1,7 +1,6 @@
var minisrv_service_file = true; var minisrv_service_file = true;
var errpage = null; var errpage = null;
const WTVRegister = require(classPath + "/WTVRegister.js")
const wtvr = new WTVRegister(minisrv_config, SessionStore); const wtvr = new WTVRegister(minisrv_config, SessionStore);
if (session_data.user_id != 0) errpage = wtvshared.doErrorPage(400, "You are not authorized to add users to this account."); if (session_data.user_id != 0) errpage = wtvshared.doErrorPage(400, "You are not authorized to add users to this account.");

View File

@@ -19,7 +19,9 @@ if (session_data.user_id != 0 && session_data.user_id != request_headers.query.u
if (user_id != null) { if (user_id != null) {
headers = `200 OK headers = `200 OK
Connection: Keep-Alive Connection: Keep-Alive
Content-Type: text/html` Content-Type: text/html
wtv-expire-all: wtv-setup:/edit-user
wtv-noback-all: wtv-setup:/edit-user`
var userSession = null; var userSession = null;
if (session_data.user_id == request_headers.query.user_id) userSession = session_data; if (session_data.user_id == request_headers.query.user_id) userSession = session_data;
else { else {
@@ -83,7 +85,7 @@ ${(user_id == 0) ? 'Subscriber' : 'User'} information
<td> <td>
<td absheight=244 valign=top align=left> <td absheight=244 valign=top align=left>
<form <form
action="wtv-setup:/serve-billing-overview" action="client:goback"
> >
<P> <P>
<table cellspacing=0 cellpadding=0 border=0> <table cellspacing=0 cellpadding=0 border=0>

View File

@@ -16,8 +16,9 @@ if (!errpage) {
} }
if (!errpage) { 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' : ''}.`); var wtvr = new WTVRegister(minisrv_config, SessionStore);
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 (!request_headers.query.user_name) errpage = wtvshared.doErrorPage(400, "Please enter a username."); if (!request_headers.query.user_name) errpage = wtvshared.doErrorPage(400, "Please enter a username.");
else if (request_headers.query.user_name.length < minisrv_config.config.user_accounts.min_username_length) errpage = wtvshared.doErrorPage(400, "Please choose a username with <b>" + minisrv_config.config.user_accounts.min_username_length + "</b> or more characters."); else if (request_headers.query.user_name.length < minisrv_config.config.user_accounts.min_username_length) errpage = wtvshared.doErrorPage(400, "Please choose a username with <b>" + minisrv_config.config.user_accounts.min_username_length + "</b> or more characters.");
else if (request_headers.query.user_name.length > minisrv_config.config.user_accounts.max_username_length) errpage = wtvshared.doErrorPage(400, "Please choose a username with <b>" + minisrv_config.config.user_accounts.max_username_length + "</b> or less characters."); else if (request_headers.query.user_name.length > minisrv_config.config.user_accounts.max_username_length) errpage = wtvshared.doErrorPage(400, "Please choose a username with <b>" + minisrv_config.config.user_accounts.max_username_length + "</b> or less characters.");

View File

@@ -156,7 +156,8 @@
"connections": 3, "connections": 3,
"privileged": true, "privileged": true,
"modules": [ "modules": [
"WTVBGMusic" "WTVBGMusic",
"WTVRegister"
] ]
}, },
"wtv-music": { "wtv-music": {