From 1d6fccfbe8303927422864c2bfbd4def34b44718 Mon Sep 17 00:00:00 2001
From: David Anderson <davea@ssl.berkeley.edu>
Date: Tue, 30 Mar 2010 20:58:39 +0000
Subject: [PATCH] - finish up the auto-team feature

svn path=/trunk/boinc/; revision=21033
---
 checkin_notes                       |  7 +++++++
 html/user/account_finish_action.php | 10 ++++++++--
 html/user/create_account.php        |  4 ++--
 3 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/checkin_notes b/checkin_notes
index f0d0ce5ade..99538e6b1b 100644
--- a/checkin_notes
+++ b/checkin_notes
@@ -2278,3 +2278,10 @@ Rom    30 Mar 2010
         
     clientgui/
         TermsOfUsePage.cpp
+
+David  30 Mar 2010
+    - finish up the auto-team feature
+
+    html/user/
+        account_finish_action.php
+        create_account.php
diff --git a/html/user/account_finish_action.php b/html/user/account_finish_action.php
index f69882c0cc..64511c567c 100644
--- a/html/user/account_finish_action.php
+++ b/html/user/account_finish_action.php
@@ -50,8 +50,14 @@ if (!$retval) {
     error_page("database error");
 }
 
-Header("Location: team_search.php");
+// team may have already been joined in create_account RPC.
+// if so, skip team-finder
+//
+if ($user->teamid) {
+    Header("Location: home.php");
+} else {
+    Header("Location: team_search.php");
+}
 send_cookie('auth', $auth, true);
 send_cookie('init', "1", true);
-
 ?>
diff --git a/html/user/create_account.php b/html/user/create_account.php
index aaf31ef5cc..2efb12d96e 100644
--- a/html/user/create_account.php
+++ b/html/user/create_account.php
@@ -46,7 +46,7 @@ $email_addr = get_str("email_addr");
 $email_addr = strtolower($email_addr);
 $passwd_hash = get_str("passwd_hash");
 $user_name = get_str("user_name");
-$team_name = get_str("user_name", true);
+$team_name = get_str("team_name", true);
 
 if (!is_valid_email_addr($email_addr)) {
     xml_error(-205);
@@ -79,7 +79,7 @@ if ($user) {
 
 if ($team_name) {
     $team_name = BoincDb::escape_string($team_name);
-    $team = BoincTeam::lookup("name='$name'");
+    $team = BoincTeam::lookup("name='$team_name'");
     if ($team && $team->joinable) {
         user_join_team($team, $user);
     }