r8598: move provisioning to /install/ directory from /esptest/
[sfrench/samba-autobuild/.git] / swat / install / newuser.esp
1 <% page_header("columns", "Add a user", "/install/menu.js"); 
2
3   libinclude("base.js");
4   libinclude("provision.js");
5 %>
6
7 <h1>Add a user</h1>
8
9 <%
10 var f = FormObj("newuser", 3, 2);
11 var i;
12
13 f.element[0].label = "User Name";
14 f.element[0].name  = "USERNAME";
15 f.element[1].label = "Unix Name";
16 f.element[1].name  = "UNIXNAME";
17 f.element[2].label = "Password";
18 f.element[2].name  = "PASSWORD";
19 f.submit[0] = "Add";
20 f.submit[1] = "Cancel";
21
22 if (form['submit'] == "Cancel") {
23         redirect("/");
24 }
25
26 if (form['submit'] == "Add" && 
27     form.USERNAME != undefined) {
28         if (form.UNIXNAME == undefined) {
29                 form.UNIXNAME = form.USERNAME;
30         }
31         if (form.PASSWORD == undefined) {
32                 form.PASSWORD = randpass();
33         }
34         newuser(form.USERNAME, form.UNIXNAME, form.PASSWORD, writefln);
35 } else {
36         display_form(f);
37 }
38 %>
39
40
41 <% page_footer(); %>