summaryrefslogtreecommitdiff
path: root/swat/install
diff options
context:
space:
mode:
Diffstat (limited to 'swat/install')
-rw-r--r--swat/install/newuser.esp34
-rw-r--r--swat/install/provision.esp3
2 files changed, 22 insertions, 15 deletions
diff --git a/swat/install/newuser.esp b/swat/install/newuser.esp
index f6f60b85a9..1b341ff665 100644
--- a/swat/install/newuser.esp
+++ b/swat/install/newuser.esp
@@ -8,17 +8,14 @@
<h1>Add a user</h1>
<%
-var f = FormObj("newuser", 3, 2);
+var f = FormObj("newuser", 0, 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].type = "password";
-f.element[2].name = "PASSWORD";
+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";
@@ -26,15 +23,24 @@ 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();
+ 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);
}
- newuser(form.USERNAME, form.UNIXNAME, form.PASSWORD, writefln);
} else {
f.display();
}
diff --git a/swat/install/provision.esp b/swat/install/provision.esp
index 38983c96dc..29fa6530de 100644
--- a/swat/install/provision.esp
+++ b/swat/install/provision.esp
@@ -61,7 +61,8 @@ if (form['submit'] == "Provision") {
} else if (!provision_validate(subobj, writefln)) {
f.display();
} else {
- provision(subobj, writefln, false, provision_default_paths(subobj), NULL, NULL);
+ provision(subobj, writefln, false, provision_default_paths(subobj),
+ session.authinfo.session_info, session.authinfo.credentials);
}
} else {
f.display();