summaryrefslogtreecommitdiff
path: root/swat/esptest/newuser.esp
blob: 2e4341fbee66e773bb33811e37d8facf3b0a5b1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<% page_header("columns", "Add a user"); 

  libinclude("base.js");
  libinclude("provision.js");
%>

<h1>Add a user</h1>

<%
var f = FormObj("newuser", 3, 2);
var i;

f.element[0].label = "User Name";
f.element[0].name  = "USERNAME";
f.element[1].label = "Unix Name";
f.element[1].name  = "UNIXNAME";
f.element[2].label = "Password";
f.element[2].name  = "PASSWORD";
f.submit[0] = "Add";
f.submit[1] = "Cancel";

if (form['submit'] == "Cancel") {
	redirect("/");
}

if (form['submit'] == "Add" && 
    form.USERNAME != undefined) {
	if (form.UNIXNAME == undefined) {
		form.UNIXNAME = form.USERNAME;
	}
	if (form.PASSWORD == undefined) {
		form.PASSWORD = randpass();
	}
	newuser(form.USERNAME, form.UNIXNAME, form.PASSWORD, writefln);
} else {
	display_form(f);
}
%>


<% page_footer(); %>