# -*- perl -*- if ($topdir == "") $topdir = ".."; require("$topdir/constants.php3"); require("$authdir/constants.php3"); require("$authdir/perror-list.php3"); require("$authdir/perror-function.php3"); require("$authdir/write-log.php3"); # Build a good FAILURE_URL $parts = parse_url($HTTP_REFERER); $FAILURE_URL = $parts["scheme"] . "://" . $parts["host"]; if ($parts["port"] <> "") { $FAILURE_URL .= ":" . $parts["port"]; } $FAILURE_URL .= $parts["path"]; if ($FAILURE_URL == "") { $FAILURE_URL = "newuser.php3"; } # Ensure that they supplied both fields $afsid = trim($afsid); if ($afsid == "") { do_perror($ERR_NO_AFSID_SUPPLIED); } elseif ($dept_radio == -1) { do_perror($ERR_NO_DEPT_SELECTED); } # Is this AFS ID already in use? $user = lookupUser($afsid); if ($user->isValid()) { do_perror($ERR_AFSID_ALREADY_IN_USE); } # Look for AFS ID in the master passwd file $fd = fopen($afsidlist, "r-"); if (!$fd) do_perror($ERR_WAY_MUCKED_UP); $found = 0; while(($line = fgets($fd, 256))) { chop($line); $vals = split(":", $line); if ($vals[0] == $afsid) { $found = 1; break; } } fclose($fd); # Did we find it? if ($found == 0) do_perror($ERR_NO_SUCH_AFSID); # Create the new user, save in database # Give the user a random (but probably pronouncable) password $u["afsid"] = $afsid; $u["gecos"] = $vals[4]; $u["dept_abbr"] = $dept_radio; $u["email"] = "$afsid@nd.edu"; # Get some values from the System record require("System.php3"); $sys = getSystem(); if ($dept_radio <> "law" && $dept_radio <> "mba" && $dept_radio <> "und" && $dept_radio <> "fac" && $dept_radio <> "staff") { $u["user_flags"] = $sys->getDefaultGradUserFlags(); } else { $u["user_flags"] = $sys->getDefaultUserFlags(); } # Set times and dates $exp_time = time(); $exp_time += $sys->getPWLength() * 24 * 60 * 60; $exp_date = date("d-M-Y", $exp_time); $u["pw_expire_date"] = $exp_date; # Set the cookie to the default $u["cookie"] = "--never set--"; $u["cookie_expire_date"] = $exp_date; # Generate the user require("User.php3"); $user = new User_lsc($u); write_log("Created new user: $afsid (" . $user->getGecos() . ")"); $theUser = $user; # Generate a new password and send password require("$authdir/mail-password.php3"); mail_password(); # Write out the user to the database $theUser->save(); ?>
Your GSU password has been mailed to " . $u["email"] . ".\n"); ?> It should arrive within the next few minutes.
Once you receive the mail, you can use your AFS ID and your new GSU password to login. You are encouraged to change your password as soon as possible. print ("
Click here to login (once you have\n"); ?> received the e-mail).
Enjoy!