Commit 26bccd9e authored by Leigh Stoller's avatar Leigh Stoller

Add target_pid,target_gid arguments to joinproject page so that

we can send links that cause those fields to be filled in for people.
Add those links to email generated by newproject and newgroup pages
so that they can be saved by the leaders.

Add a bit of referrer magic to login page. When clicked from the join
or new project pages, tell login page to pass along the referrer page
so that when login is complete, user is zapped back to the original
page. This is especially nice when combined with the above change to
joinproject, whereby we send along the target pid/gid, but the user
has not yet logged in and remembers to do so via the link at the top
of the page.
parent d26f8288
...@@ -12,3 +12,24 @@ stoller 2003/03/27 17:01:52 MST ...@@ -12,3 +12,24 @@ stoller 2003/03/27 17:01:52 MST
There is still some copy problems with files, but leaving that till There is still some copy problems with files, but leaving that till
later to deal with. later to deal with.
stoller 2003/03/29 10:23:30 MST
Modified files:
www approveproject.php3 joinproject.php3
login.php3 newgroup.php3 newproject.php3
reqaccount.php3
Log:
Add target_pid,target_gid arguments to joinproject page so that
we can send links that cause those fields to be filled in for people.
Add those links to email generated by newproject and newgroup pages
so that they can be saved by the leaders.
Add a bit of referrer magic to login page. When clicked from the join
or new project pages, tell login page to pass along the referrer page
so that when login is complete, user is zapped back to the original
page. This is especially nice when combined with the above change to
joinproject, whereby we send along the target pid/gid, but the user
has not yet logged in and remembers to do so via the link at the top
of the page.
...@@ -222,9 +222,13 @@ elseif (strcmp($approval, "approve") == 0) { ...@@ -222,9 +222,13 @@ elseif (strcmp($approval, "approve") == 0) {
"Project '$pid' Approval", "Project '$pid' Approval",
"\n". "\n".
"This message is to notify you that your project $pid\n". "This message is to notify you that your project $pid\n".
"has been approved.\n". "has been approved. Please save this link so that you can send it\n".
"\n$message". "to people you wish to have join your project:\n".
"\n\n". "\n".
" ${TBBASE}/joinproject.php3?target_pid=$pid\n".
"\n".
"$message\n".
"\n".
"Thanks,\n". "Thanks,\n".
"Testbed Operations\n", "Testbed Operations\n",
"From: $TBMAIL_APPROVAL\n". "From: $TBMAIL_APPROVAL\n".
......
...@@ -8,7 +8,7 @@ include("defs.php3"); ...@@ -8,7 +8,7 @@ include("defs.php3");
# #
# No PAGEHEADER since we spit out a Location header later. See below. # No PAGEHEADER since we spit out a Location header later. See below.
# #
# #
# Get current user. # Get current user.
...@@ -56,8 +56,9 @@ function SPITFORM($formfields, $returning, $errors) ...@@ -56,8 +56,9 @@ function SPITFORM($formfields, $returning, $errors)
if (! $returning) { if (! $returning) {
echo "<center><font size=+1> echo "<center><font size=+1>
If you already have an Emulab account, <a href=login.php3> If you already have an Emulab account,
please log on first!</a> <a href=login.php3?refer=1>
<font color=red>please log on first!</font></a>
</font></center><br>\n"; </font></center><br>\n";
} }
...@@ -352,6 +353,16 @@ if (isset($finished)) { ...@@ -352,6 +353,16 @@ if (isset($finished)) {
if (! isset($submit)) { if (! isset($submit)) {
$defaults = array(); $defaults = array();
$defaults[usr_URL] = "$HTTPTAG"; $defaults[usr_URL] = "$HTTPTAG";
#
# These two allow presetting the pid/gid.
#
if (isset($target_pid) && strcmp($target_pid, "")) {
$defaults[pid] = $target_pid;
}
if (isset($target_gid) && strcmp($target_gid, "")) {
$defaults[gid] = $target_gid;
}
SPITFORM($defaults, $returning, 0); SPITFORM($defaults, $returning, 0);
PAGEFOOTER(); PAGEFOOTER();
......
<?php <?php
# #
# EMULAB-COPYRIGHT # EMULAB-COPYRIGHT
# Copyright (c) 2000-2002 University of Utah and the Flux Group. # Copyright (c) 2000-2003 University of Utah and the Flux Group.
# All rights reserved. # All rights reserved.
# #
require("defs.php3"); require("defs.php3");
...@@ -15,6 +15,16 @@ if (!isset($key) || !strcmp($key, "")) { ...@@ -15,6 +15,16 @@ if (!isset($key) || !strcmp($key, "")) {
if (!isset($vuid) || !strcmp($vuid, "")) { if (!isset($vuid) || !strcmp($vuid, "")) {
$vuid = 0; $vuid = 0;
} }
# Allow referrer to be passed along.
if (!isset($referrer) || !strcmp($referrer, "")) {
$referrer = 0;
}
# Referrer page requested that it be passed along so that it can be
# redisplayed after login. Save the referrer for form below.
if (isset($refer) && $refer &&
isset($HTTP_REFERER) && strcmp($HTTP_REFERER, "")) {
$referrer = $HTTP_REFERER;
}
# #
# Must not be logged in already! # Must not be logged in already!
...@@ -44,7 +54,7 @@ if (($known_uid = GETUID()) != FALSE) { ...@@ -44,7 +54,7 @@ if (($known_uid = GETUID()) != FALSE) {
# #
# Spit out the form. # Spit out the form.
# #
function SPITFORM($uid, $key, $failed) function SPITFORM($uid, $key, $referrer, $failed)
{ {
global $TBDB_UIDLEN, $TBBASE; global $TBDB_UIDLEN, $TBBASE;
...@@ -84,8 +94,13 @@ function SPITFORM($uid, $key, $failed) ...@@ -84,8 +94,13 @@ function SPITFORM($uid, $key, $failed)
<tr> <tr>
<td align=center colspan=2> <td align=center colspan=2>
<b><input type=submit value=Login name=login></b></td> <b><input type=submit value=Login name=login></b></td>
</tr> </tr>\n";
</form>
if ($referrer) {
echo "<input type=hidden name=referrer value=$referrer>\n";
}
echo "</form>
</table>\n"; </table>\n";
echo "<center><h2> echo "<center><h2>
...@@ -115,7 +130,7 @@ if (0 && NOLOGINS()) { ...@@ -115,7 +130,7 @@ if (0 && NOLOGINS()) {
if (! isset($login)) { if (! isset($login)) {
if ($vuid) if ($vuid)
$known_uid = $vuid; $known_uid = $vuid;
SPITFORM($known_uid, $key, 0); SPITFORM($known_uid, $key, $referrer, 0);
PAGEFOOTER(); PAGEFOOTER();
return; return;
} }
...@@ -144,7 +159,7 @@ else { ...@@ -144,7 +159,7 @@ else {
# Failed, then try again with an error message. # Failed, then try again with an error message.
# #
if ($login_status == $STATUS_LOGINFAIL) { if ($login_status == $STATUS_LOGINFAIL) {
SPITFORM($uid, $key, 1); SPITFORM($uid, $key, $referrer, 1);
PAGEFOOTER(); PAGEFOOTER();
return; return;
} }
...@@ -155,6 +170,12 @@ if ($key) { ...@@ -155,6 +170,12 @@ if ($key) {
# #
header("Location: $TBBASE/verifyusr.php3?key=$key"); header("Location: $TBBASE/verifyusr.php3?key=$key");
} }
elseif ($referrer) {
#
# Zap back to page that started the login request.
#
header("Location: $referrer");
}
else { else {
# #
# Zap back to front page in secure mode. # Zap back to front page in secure mode.
......
...@@ -142,6 +142,26 @@ TBGroupUnixInfo($group_pid, $group_pid, $unix_gid, $unix_name); ...@@ -142,6 +142,26 @@ TBGroupUnixInfo($group_pid, $group_pid, $unix_gid, $unix_name);
SUEXEC($uid, $unix_gid, "webmkgroup $group_pid $group_id", 1); SUEXEC($uid, $unix_gid, "webmkgroup $group_pid $group_id", 1);
SUEXEC($uid, $unix_gid, "websetgroups $group_leader", 1); SUEXEC($uid, $unix_gid, "websetgroups $group_leader", 1);
#
# Send an email message with a join link.
#
TBUserInfo($group_leader, $group_leader_name, $group_leader_email);
TBUserInfo($uid, $user_name, $user_email);
TBMAIL("$group_leader_name '$group_leader' <$group_leader_email>",
"New Group '$group_pid/$group_id' Created",
"\n".
"This message is to notify you that group '$group_id' in project\n".
"'$group_pid' has been created. Please save this link so that you\n".
"send it to people you wish to have join this group:\n".
"\n".
" ${TBBASE}/joinproject.php3".
"?target_pid=$group_pid&target_gid=$group_id\n".
"\n",
"From: $user_name '$uid' <$user_email>\n".
"CC: $user_name '$uid' <$user_email>\n".
"Errors-To: $TBMAIL_WWW");
# #
# Spit out a redirect so that the history does not include a post # Spit out a redirect so that the history does not include a post
# in it. The back button skips over the post and to the form. # in it. The back button skips over the post and to the form.
......
...@@ -65,8 +65,9 @@ function SPITFORM($formfields, $returning, $errors) ...@@ -65,8 +65,9 @@ function SPITFORM($formfields, $returning, $errors)
if (! $returning) { if (! $returning) {
echo "<center><font size=+1> echo "<center><font size=+1>
If you already have an Emulab account, <a href=login.php3> If you already have an Emulab account,
please log on first!</a> <a href=login.php3?refer=1>
<font color=red>please log on first!</font></a>
</font></center><br>\n"; </font></center><br>\n";
} }
......
...@@ -12,8 +12,9 @@ include("defs.php3"); ...@@ -12,8 +12,9 @@ include("defs.php3");
PAGEHEADER("Request a New Emulab Account"); PAGEHEADER("Request a New Emulab Account");
echo "<center><font size=+1> echo "<center><font size=+1>
If you already have an Emulab account, <a href=login.php3> If you already have an Emulab account,
please log on first!</a> <a href=login.php3>
<font color=red>please log on first!</font></a>
<br><br> <br><br>
<a href=joinproject.php3>Join an Existing Project</a>. <a href=joinproject.php3>Join an Existing Project</a>.
<br> <br>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment