summaryrefslogtreecommitdiff
path: root/swat/install
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2006-01-10 10:35:47 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:50:02 -0500
commit75ef0ba513489a85557cb486135d80286d620809 (patch)
treedfc696095f47deda33984b38d97475faa377f74b /swat/install
parent195f5c3635159013fa14fbe0d34283b8237b0667 (diff)
downloadsamba-75ef0ba513489a85557cb486135d80286d620809.tar.gz
samba-75ef0ba513489a85557cb486135d80286d620809.tar.bz2
samba-75ef0ba513489a85557cb486135d80286d620809.zip
r12823: Fix up the provison and newuser code in SWAT. This also cleans up the
main provision script a bit, as the argument list was getting out of control. (It has been replaced in part with an object). This also returns the session_info from the auth code into ejs. We still need access control allowing only root to re-provision. Andrew Bartlett (This used to be commit 002cdcf3cab6563909d31edc5d825e857dc0a732)
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();