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
44
45
46
47
48
49
50
|
<% 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", 0, 2);
var i;
var rand = random_init();
f.add("USERNAME", "User Name");
f.add("UNIXNAME", "Unix Name");
f.add("PASSWORD", "Password", "password");
f.add("CONFIRM", "Confirm Password", "password");
f.submit[0] = "Add";
f.submit[1] = "Cancel";
if (form['submit'] == "Cancel") {
redirect("/");
}
if (form['submit'] == "Add" &&
form.USERNAME != undefined) {
var goodpass = (form.CONFIRM == form.PASSWORD);
if (!goodpass) {
write("<h3>Passwords don't match. Please try again.</h3>");
f.display();
} else {
if (form.UNIXNAME == undefined) {
form.UNIXNAME = form.USERNAME;
}
if (form.PASSWORD == undefined) {
form.PASSWORD = rand.randpass();
}
newuser(form.USERNAME, form.UNIXNAME, form.PASSWORD, writefln,
session.authinfo.session_info, session.authinfo.credentials);
}
} else {
f.display();
}
%>
<% page_footer(); %>
|