Hi Mitch (is that your name?)
Firstly, you'll only be able to use it with the Enterprise Edition of CompleteFTP. If you're not already evaluating the Enterprise Edition then you can upgrade the trial via the Licensing tab in CompleteFTP Manager.
Before the script will run we'll create a new user that has permission to add other users:
- Open CompleteFTP Manager
- Create a non-Windows user with any user-name and password of your choice.
- You now need to allow this new user to create users:
- Select the Extensions panel
- Click 'Add user permission'
- In the newly created row select 'AdminCustomCommand' in the first column and the newly created user in the second column.
- Press the tab button so that the Apply button lights up
- Click the Apply button
The new user should now be able to add users. You can verify this from your browser.
- Navigate to https://localhost. You may get a security warning due to the fact that no proper SSL certificate has been installed. Ignore this error and proceed.
- Click "Login".
- Log in using the user-name and password of the user that you created just before.
- Now copy this URL into your browser.
After a few seconds you should see a user called Test1 in the user list in CompleteFTP Manager.
Now, to create a web-app that does this:
- Copy code below into a file called index.jss, located in the directory, C:\ProgramData\Enterprise Distributed Technologies\Complete FTP\Users\USERNAME where USERNAME is the user-name of the user you created in step 2.
- Navigate to https://localhost/Home/USERNAME/index.jss where USERNAME. You should see a form titled Add user and three fields.
- Fill out the fields and hit submit. Again after a few seconds you should see this user appear in the Manager.
The JSS code:
var userName = request.form.userName;
var password = request.form.password;
var confirmPassword = request.form.confirmPassword;
var message = null;
if (password && !confirmPassword)
message = "Please enter password twice";
else if (password!=confirmPassword)
message = "ERROR: Passwords don't match.";
else if (userName && password && password==confirmPassword)
message = system.executeCustomCommand("AddUser", ["-r", password, userName]);
response.write("<html><body><h1>Add user</h1>");
if (message)
response.write(message + "<br><br>");
response.write("\
<form method=post>\
<table>\
<tr>\
<td>User-name:</td>\
<td><input type=text name=userName></td>\
</tr>\
<tr>\
<td>Password:</td>\
<td><input type=password name=password></td>\
</tr>\
<tr>\
<td>Confirm password:</td>\
<td><input type=password name=confirmPassword></td>\
</tr>\
</table>\
<input type=submit>\
</form>\
");
response.write("</body></html>");
Note that this JSS code has been written so that it's easy to understand for someone who doesn't already know JSS. It can be greatly improved through the use of a template. I can tell you more about that later after you get this working. You can read more about JSS in the 'Web apps' section of the
CompleteFTP User Guide.
Please let me know how this goes for you.
- Hans (EnterpriseDT)