1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-29 11:21:54 +03:00
samba-mirror/swat/install/newuser.esp
Andrew Bartlett 75ef0ba513 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 002cdcf3ca)
2007-10-10 13:50:02 -05:00

51 lines
1.0 KiB
Plaintext

<% page_header("columns", "Add a user", "install");
include("/scripting/forms.js");
libinclude("base.js");
libinclude("provision.js");
%>
<h1>Add a user</h1>
<%
var f = FormObj("newuser", 0, 2);
var i;
var rand = random_init();
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";
if (form['submit'] == "Cancel") {
redirect("/");
}
if (form['submit'] == "Add" &&
form.USERNAME != undefined) {
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);
}
} else {
f.display();
}
%>
<% page_footer(); %>