ed8a52ff880f7d61f8fe06f1e9e974a5d81000ca
chinhli
  Fri Jun 1 19:41:59 2012 -0700
Use genome-www@soe.ucsc.edu as sender of all out going mails.
diff --git src/hg/hgLogin/hgLogin.c src/hg/hgLogin/hgLogin.c
index edbc608..cb809eb 100644
--- src/hg/hgLogin/hgLogin.c
+++ src/hg/hgLogin/hgLogin.c
@@ -281,31 +281,32 @@
     "<p id=\"confirmationMsg\" class=\"confirmationTxt\">A confirmation email has been sent to you. \n"
     "Please click the confirmation link in the email to activate your account.</p>"
     "\n"
     "<p><a href=\"%s\">Return</a></p>", returnURL);
 cartRemove(cart, "hgLogin_email");
 cartRemove(cart, "hgLogin_userName");
 }
 
 
 void sendActMailOut(char *email, char *subject, char *msg)
 /* send mail to email address */
 {
 char *hgLoginHost = wikiLinkHost();
 char cmd[4096];
 safef(cmd,sizeof(cmd),
-    "echo '%s' | mail -s \"%s\" %s" , msg, subject, email);
+    "echo '%s' | mail -s \"%s\" %s  -- -f genome-www@soe.ucsc.edu", 
+    msg, subject, email);
 int result = system(cmd);
 if (result == -1)
     {
     hPrintf(
         "<h2>UCSC Genome Browser</h2>"
         "<p align=\"left\">"
         "</p>"
         "<h3>Error emailing to: %s</h3>"
         "Click <a href=hgLogin?hgLogin.do.displayAccHelpPage=1>here</a> to return.<br>", email );
     }
 else
     {
     hPrintf("<script  language=\"JavaScript\">\n"
         "<!-- \n"
         "window.location =\"http://%s/cgi-bin/hgLogin?hgLogin.do.displayActMailSuccess=1\""
@@ -326,58 +327,59 @@
    "containing information that you requested.</p>"
     "\n"
     "<p><a href=\"hgLogin?hgLogin.do.displayLoginPage=1\">Return to Login</a></p>");
 cartRemove(cart, "hgLogin_helpWith");
 cartRemove(cart, "hgLogin_email");
 cartRemove(cart, "hgLogin_userName");
 }
 
 void sendMailOut(char *email, char *subject, char *msg)
 /* send mail to email address */
 {
 char *hgLoginHost = wikiLinkHost();
 char *obj = cartUsualString(cart, "hgLogin_helpWith", "");
 char cmd[4096];
 safef(cmd,sizeof(cmd),
-    "echo '%s' | mail -s \"%s\" %s" , msg, subject, email);
+    "echo '%s' | mail -s \"%s\" %s -- -f genome-www@soe.ucsc.edu",
+    msg, subject, email);
 int result = system(cmd);
 if (result == -1)
     {
     hPrintf( 
         "<h2>UCSC Genome Browser</h2>"
         "<p align=\"left\">"
         "</p>"
         "<h3>Error emailing %s to: %s</h3>"
         "Click <a href=hgLogin?hgLogin.do.displayAccHelpPage=1>here</a> to return.<br>", 
         obj, email );
     }
 else
     {
     hPrintf("<script  language=\"JavaScript\">\n"
         "<!-- \n"
         "window.location =\"http://%s/cgi-bin/hgLogin?hgLogin.do.displayMailSuccess=1\""
         "//-->"
         "\n"
         "</script>", hgLoginHost);
     }
 }
 
 void mailUsername(char *email, char *users)
 /* send user name list to the email address */
 {
 char subject[256];
-char msg[256];
+char msg[4096];
 char *remoteAddr=getenv("REMOTE_ADDR");
 
 safef(subject, sizeof(subject),"Your user name at the UCSC Genome Browser");
 safef(msg, sizeof(msg), 
     "Someone (probably you, from IP address %s) has requested user name(s) associated with this email address at UCSC Genome Browser: \n\n  %s\n\n", 
    remoteAddr, users);
 safecat (msg, sizeof(msg), signature);
 sendMailOut(email, subject, msg);
 }
 
 void sendUsername(struct sqlConnection *conn, char *email)
 /* email user username(s)  */
 {
 struct sqlResult *sr;
 char **row;
@@ -609,30 +611,32 @@
     "select emailToken from gbMembers where userName='%s'", username);
 char *emailToken = sqlQuickString(conn, query);
 if (sameString(emailToken, token))
     {
     safef(query,sizeof(query), "update gbMembers set lastUse=NOW(), dateActivated=NOW(), emailToken='', emailTokenExpires='', accountActivated='Y' where userName='%s'",
     username);
     sqlUpdate(conn, query);
     freez(&errMsg);
     errMsg = cloneString("Your account has been activated.");
     } 
 else
     {
     freez(&errMsg);
     errMsg = cloneString("Token does not match.");
     }
+cartSetString(cart, "hgLogin_userName", username);
+
 displayLoginPage(conn);
 return;
 }
 
 /* -------- functions ---- */
 
 void changePasswordPage(struct sqlConnection *conn)
 /* change password page */
 {
 hPrintf("<div id=\"changePwBox\" class=\"centeredContainer formBox\">"
     "\n"
     "<h2>UCSC Genome Browser</h2>"
     "\n"
     "<h3>Change Password</h3>"
     "\n"
@@ -795,34 +799,36 @@
     "<label for=\"password\">Password <small>(must be at least 5 characters)</small></label>"
     "<input type=password name=\"hgLogin_password\" value=\"%s\" size=\"30\" id=\"password\">"
     "</div>"
     "\n"
     "<div class=\"inputGroup\">"
     "<label for=\"password\">Re-enter Password</label>"
     "<input type=password name=\"hgLogin_password2\" value=\"%s\" size=\"30\" id=\"passwordCheck\">"
     "\n"
     "</div>"
     "\n"
     "<div class=\"formControls\">"
     "    <input type=\"submit\" name=\"hgLogin.do.signup\" value=\"Sign Up\" class=\"largeButton\"> &nbsp; "
     "    <a href=\"javascript:history.go(-1)\">Cancel</a>"
     "</div>"
     "</form>"
-    "</div><!-- END - signUpBox -->"
-    "\n", cartUsualString(cart, "hgLogin_password", ""), cartUsualString(cart, "hgLogin_password2", ""));
+    "</div><!-- END - signUpBox -->",
+     cartUsualString(cart, "hgLogin_password", ""), cartUsualString(cart, "hgLogin_password2", ""));
+// hPrintf("</FORM>");
+/**** new validate code *****/
+
 cartSaveSession(cart);
-hPrintf("</FORM>");
 }
 
 void signup(struct sqlConnection *conn)
 /* process the signup form */
 {
 char query[256];
 char *user = cartUsualString(cart, "hgLogin_userName", "");
 if (!user || sameString(user,""))
     {
     freez(&errMsg);
     errMsg = cloneString("User name cannot be blank.");
     signupPage(conn);
     return;
     }
 safef(query,sizeof(query), "select password from gbMembers where userName='%s'", user);