summaryrefslogtreecommitdiff
path: root/swat/install/provision.esp
blob: 284be96a5f3b7bad91fada3a37946a936cef43cc (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<% page_header("columns", "Provisioning", "install"); 

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

<h1>Samba4 provisioning</h1>

<%
var f = FormObj("Provisioning", 0, 3);
var i;
var lp = loadparm_init();

if (lp.get("realm") == "") {
	lp.set("realm", lp.get("workgroup") + ".example.com");
}


var subobj = provision_guess();
/* Don't supply default password for web interface */
subobj.ADMINPASS = "";

f.add("REALM", "Realm");
f.add("DOMAIN", "Domain Name");
f.add("HOSTNAME", "Hostname");
f.add("ADMINPASS", "Administrator Password", "password");
f.add("CONFIRM", "Confirm Password", "password");
f.add("DOMAINSID", "Domain SID");
f.add("HOSTGUID", "Host GUID");
f.add("BASEDN", "Base DN");
f.add("HOSTIP", "Host IP");
f.add("DEFAULTSITE", "Default Site");
f.submit[0] = "Initial provision";
f.submit[1] = "Provision";
f.submit[2] = "Cancel";

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

if ((form['submit'] == "Provision") || (form['submit'] == "Initial provision")) {
	for (r in form) {
		subobj[r] = form[r];
	}
}

for (i=0;i<f.element.length;i++) {
	f.element[i].value = subobj[f.element[i].name];
}

lp.set("realm", subobj.REALM);

var goodpass = (subobj.CONFIRM == subobj.ADMINPASS);
if (form['submit'] == "Provision" && goodpass) {
	provision(subobj, writefln, true);
} else if (form['submit'] == "Initial provision" && goodpass) {
	provision(subobj, writefln, false);
} else {
	if (!goodpass && form['submit'] != undefined) {
		write("<h3>Passwords don't match.  Please try again.</h3>");
	}
	f.display();
}
%>


<% page_footer(); %>