diff options
author | Andrew Bartlett <abartlet@samba.org> | 2006-01-10 10:35:47 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:50:02 -0500 |
commit | 75ef0ba513489a85557cb486135d80286d620809 (patch) | |
tree | dfc696095f47deda33984b38d97475faa377f74b /swat | |
parent | 195f5c3635159013fa14fbe0d34283b8237b0667 (diff) | |
download | samba-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')
-rw-r--r-- | swat/index.esp | 2 | ||||
-rw-r--r-- | swat/install/newuser.esp | 34 | ||||
-rw-r--r-- | swat/install/provision.esp | 3 |
3 files changed, 23 insertions, 16 deletions
diff --git a/swat/index.esp b/swat/index.esp index c0bfbdec05..1924e40210 100644 --- a/swat/index.esp +++ b/swat/index.esp @@ -3,7 +3,7 @@ libinclude("management.js"); libinclude("provision.js"); - if (install_ok() == false) { + if (install_ok(session.authinfo.session_info, session.authinfo.credentials) == false) { redirect("/install/"); } 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(); |