r12822: Given that talloc gives us this extra level of safety, use it.
[kai/samba.git] / swat / install / newuser.esp
1 <% page_header("columns", "Add a user", "install"); 
2
3   include("/scripting/forms.js");
4   libinclude("base.js");
5   libinclude("provision.js");
6 %>
7
8 <h1>Add a user</h1>
9
10 <%
11 var f = FormObj("newuser", 3, 2);
12 var i;
13 var rand = random_init();
14
15 f.element[0].label = "User Name";
16 f.element[0].name  = "USERNAME";
17 f.element[1].label = "Unix Name";
18 f.element[1].name  = "UNIXNAME";
19 f.element[2].label = "Password";
20 f.element[2].type  = "password";
21 f.element[2].name  = "PASSWORD";
22 f.submit[0] = "Add";
23 f.submit[1] = "Cancel";
24
25 if (form['submit'] == "Cancel") {
26         redirect("/");
27 }
28
29 if (form['submit'] == "Add" && 
30     form.USERNAME != undefined) {
31         if (form.UNIXNAME == undefined) {
32                 form.UNIXNAME = form.USERNAME;
33         }
34         if (form.PASSWORD == undefined) {
35                 form.PASSWORD = rand.randpass();
36         }
37         newuser(form.USERNAME, form.UNIXNAME, form.PASSWORD, writefln);
38 } else {
39         f.display();
40 }
41 %>
42
43
44 <% page_footer(); %>