diff options
author | Deryck Hodge <deryck@samba.org> | 2005-08-10 19:25:07 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:31:34 -0500 |
commit | 55024676c7ab56189bb7089bae1569e34dcdf458 (patch) | |
tree | 607db686f6a32a8f93af705426387c210bc79544 | |
parent | d3751c45258a1fac9eb2117fcc67bab0159b730c (diff) | |
download | samba-55024676c7ab56189bb7089bae1569e34dcdf458.tar.gz samba-55024676c7ab56189bb7089bae1569e34dcdf458.tar.bz2 samba-55024676c7ab56189bb7089bae1569e34dcdf458.zip |
r9230: Star out passwords and add confim text input for provisioning.
Also, add addMethod() to form elements now.
deryck
(This used to be commit 79f276df47ebc93e1505c7411fb1acd4b004047c)
-rw-r--r-- | swat/install/provision.esp | 41 | ||||
-rw-r--r-- | swat/scripting/forms.js | 19 |
2 files changed, 38 insertions, 22 deletions
diff --git a/swat/install/provision.esp b/swat/install/provision.esp index 9316445d7f..284be96a5f 100644 --- a/swat/install/provision.esp +++ b/swat/install/provision.esp @@ -8,7 +8,7 @@ <h1>Samba4 provisioning</h1> <% -var f = FormObj("Provisioning", 9, 2); +var f = FormObj("Provisioning", 0, 3); var i; var lp = loadparm_init(); @@ -18,26 +18,19 @@ if (lp.get("realm") == "") { var subobj = provision_guess(); +/* Don't supply default password for web interface */ +subobj.ADMINPASS = ""; -f.element[0].label = "Realm"; -f.element[0].name = "REALM"; -f.element[1].label = "Domain Name"; -f.element[1].name = "DOMAIN"; -f.element[2].label = "Host Name"; -f.element[2].name = "HOSTNAME"; -f.element[3].label = "Administrator Password"; -f.element[3].name = "ADMINPASS"; -f.element[3].type = "password"; -f.element[4].label = "Domain SID"; -f.element[4].name = "DOMAINSID"; -f.element[5].label = "Host GUID"; -f.element[5].name = "HOSTGUID"; -f.element[6].label = "Base DN"; -f.element[6].name = "BASEDN"; -f.element[7].label = "Host IP"; -f.element[7].name = "HOSTIP"; -f.element[8].label = "Default Site"; -f.element[8].name = "DEFAULTSITE"; +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"; @@ -58,11 +51,15 @@ for (i=0;i<f.element.length;i++) { lp.set("realm", subobj.REALM); -if (form['submit'] == "Provision") { +var goodpass = (subobj.CONFIRM == subobj.ADMINPASS); +if (form['submit'] == "Provision" && goodpass) { provision(subobj, writefln, true); -} else if (form['submit'] == "Initial provision") { +} 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(); } %> diff --git a/swat/scripting/forms.js b/swat/scripting/forms.js index e44deeb180..2de9e34462 100644 --- a/swat/scripting/forms.js +++ b/swat/scripting/forms.js @@ -10,6 +10,8 @@ f.action = action to be taken on submit (optional, defaults to current page) f.class = css class (optional, defaults to 'form') f.submit = an array of submit labels + f.add(name, label, [type], [value]) = + Add another element f.element[i].label = element label f.element[i].name = element name (defaults to label) f.element[i].type = element type (defaults to text) @@ -69,6 +71,22 @@ function form_display() { write("</form>\n"); } +function __addMethod(name, label) +{ + var f = this; + var i = f.element.length; + f.element[i] = new Object(); + f.element[i].name = name; + f.element[i].label = label; + f.element[i].type = "text"; + f.element[i].value = ""; + if (arguments.length > 2) { + f.element[i].type = arguments[2]; + } + if (arguments.length > 3) { + f.element[i].value = arguments[3]; + } +} /* create a Form object with the defaults filled in, ready for display() @@ -81,6 +99,7 @@ function FormObj(name, num_elements, num_submits) f.submit = new Array(num_submits); f.action = session_uri(request.REQUEST_URI); f.class = "defaultform"; + f.add = __addMethod; for (i in f.element) { f.element[i] = new Object(); f.element[i].type = "text"; |