summaryrefslogtreecommitdiff
path: root/swat/install/newuser.esp
blob: 9baba7c6f4a518184a435323455fe3175ccc1637 (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
42
43
<% page_header("columns", "Add a user", "install"); 

  include("/scripting/forms.js");
  libinclude("base.js");
  libinclude("provision.js");
%>

<h1>Add a user</h1>

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

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 = rand.randpass();
	}
	newuser(form.USERNAME, form.UNIXNAME, form.PASSWORD, writefln);
} else {
	f.display();
}
%>


<% page_footer(); %>