ECLIPSE + PyDev Project
[Samba/kamenim.git] / swat2 / install / newuser.esp
blob1b341ff6653d228b54aa69a84e85ae6ea9a5dd9c
1 <% page_header("columns", "Add a user", "install"); 
3   include("/scripting/forms.js");
4   libinclude("base.js");
5   libinclude("provision.js");
6 %>
8 <h1>Add a user</h1>
11 var f = FormObj("newuser", 0, 2);
12 var i;
13 var rand = random_init();
15 f.add("USERNAME", "User Name");
16 f.add("UNIXNAME", "Unix Name");
17 f.add("PASSWORD", "Password", "password");
18 f.add("CONFIRM", "Confirm Password", "password");
19 f.submit[0] = "Add";
20 f.submit[1] = "Cancel";
22 if (form['submit'] == "Cancel") {
23         redirect("/");
27 if (form['submit'] == "Add" && 
28     form.USERNAME != undefined) {
29         var goodpass = (form.CONFIRM == form.PASSWORD);
31         if (!goodpass) {
32                 write("<h3>Passwords don't match.  Please try again.</h3>");
33                 f.display();
34         } else {
35                 if (form.UNIXNAME == undefined) {
36                         form.UNIXNAME = form.USERNAME;
37                 }
38                 if (form.PASSWORD == undefined) {
39                         form.PASSWORD = rand.randpass();
40                 }
41                 newuser(form.USERNAME, form.UNIXNAME, form.PASSWORD, writefln, 
42                         session.authinfo.session_info, session.authinfo.credentials);
43         }
44 } else {
45         f.display();
50 <% page_footer(); %>