diff options
Diffstat (limited to 'swat')
-rw-r--r-- | swat/esptest/menu.js | 1 | ||||
-rw-r--r-- | swat/esptest/newuser.esp | 41 |
2 files changed, 42 insertions, 0 deletions
diff --git a/swat/esptest/menu.js b/swat/esptest/menu.js index d2a145cc5c..62aa46072b 100644 --- a/swat/esptest/menu.js +++ b/swat/esptest/menu.js @@ -2,6 +2,7 @@ simple_menu( "ESP Tests", "Provisioning", session_uri("/esptest/provision.esp"), + "New User", session_uri("/esptest/newuser.esp"), "ldb database", session_uri("/esptest/ldb.esp"), "samr calls", session_uri("/esptest/samr.esp"), "html forms", session_uri("/esptest/formtest.esp"), diff --git a/swat/esptest/newuser.esp b/swat/esptest/newuser.esp new file mode 100644 index 0000000000..2e4341fbee --- /dev/null +++ b/swat/esptest/newuser.esp @@ -0,0 +1,41 @@ +<% page_header("columns", "Add a user"); + + libinclude("base.js"); + libinclude("provision.js"); +%> + +<h1>Add a user</h1> + +<% +var f = FormObj("newuser", 3, 2); +var i; + +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].name = "PASSWORD"; +f.submit[0] = "Add"; +f.submit[1] = "Cancel"; + +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 = randpass(); + } + newuser(form.USERNAME, form.UNIXNAME, form.PASSWORD, writefln); +} else { + display_form(f); +} +%> + + +<% page_footer(); %> |