An account activation email has been sent to you \n"
+ "Please activate your account within 7 days.
", returnURL);
+cartRemove(cart, "hgLogin_helpWith");
+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);
+int result = system(cmd);
+if (result == -1)
+ {
+ hPrintf(
+ "
to return.
", email );
+ }
+else
+ {
+ hPrintf("", hgLoginHost);
+ }
}
void displayMailSuccess()
/* display mail success confirmation box */
{
hPrintf(
"
"
"\n"
"
UCSC Genome Browser
"
"
An email has been sent to you \n"
"containing information that you requested.
"
"\n"
"
Return to Login
");
cartRemove(cart, "hgLogin_helpWith");
cartRemove(cart, "hgLogin_email");
@@ -290,41 +358,39 @@
char *obj = cartUsualString(cart, "hgLogin_helpWith", "");
char cmd[4096];
safef(cmd,sizeof(cmd),
"echo '%s' | mail -s \"%s\" %s" , msg, subject, email);
int result = system(cmd);
if (result == -1)
{
hPrintf(
"
UCSC Genome Browser
"
"
"
"
"
"
Error emailing %s to: %s
"
"Click
here to return.
",
obj, email );
}
-//***** TODO replace a modal window
else
{
hPrintf("", hgLoginHost);
}
-/********************************/
}
void mailUsername(char *email, char *users)
/* send user name list to the email address */
{
char subject[256];
char msg[256];
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 associated with this email address at UCSC Genome Browser. Your user name is: \n\n %s\n\n",
remoteAddr, users);
safecat (msg, sizeof(msg), signature);
sendMailOut(email, subject, msg);
@@ -474,31 +540,31 @@
char subject[256];
char msg[4096];
char activateURL[256];
char *hgLoginHost = wikiLinkHost();
char *remoteAddr=getenv("REMOTE_ADDR");
safef(activateURL, sizeof(activateURL),
"http://%s/cgi-bin/hgLogin?hgLogin.do.activateAccount=1&user=%s&token=%s\n",
sqlEscapeString(hgLoginHost),
sqlEscapeString(username),
sqlEscapeString(encToken));
safef(subject, sizeof(subject),"UCSC Genome Browser account e-mail address confirmation");
safef(msg, sizeof(msg),
"Someone (probably you, from IP address %s) has requested an account %s with this e-mail address on the UCSC Genome Browser.\n\nTo confirm that this account really does belong to you on the UCSC Genome Browser, open this link in your browser:\n\n%s\n\nIf this is *not* you, do not follow the link. This confirmation code will expire in 7 days.\n",
remoteAddr, username, activateURL);
safecat (msg, sizeof(msg), signature);
-sendMailOut(email, subject, msg);
+sendActMailOut(email, subject, msg);
}
void setupNewAccount(struct sqlConnection *conn, char *email, char *username)
/* Set up new user account and send activation mail to user */
{
char query[256];
char *token = generateRandomPassword();
char *tokenMD5 = generateTokenMD5(token);
safef(query,sizeof(query), "update gbMembers set lastUse=NOW(),emailToken='%s', emailTokenExpires=DATE_ADD(NOW(), INTERVAL 7 DAY), accountActivated='N' where userName='%s'",
sqlEscapeString(tokenMD5),
sqlEscapeString(username)
);
sqlUpdate(conn, query);
sendActivateMail(email, username, tokenMD5);
return;
@@ -830,30 +896,31 @@
{
freez(&errMsg);
errMsg = cloneString("Passwords do not match.");
signupPage(conn);
return;
}
/* pass all the checks, OK to create the account now */
char encPwd[45] = "";
encryptNewPwd(password, encPwd, sizeof(encPwd));
safef(query,sizeof(query), "insert into gbMembers set "
"userName='%s',password='%s',email='%s', "
"lastUse=NOW(),accountActivated='N'",
sqlEscapeString(user),sqlEscapeString(encPwd),sqlEscapeString(email));
sqlUpdate(conn, query);
+/********** new signup process start *******************/
setupNewAccount(conn, email, user);
/* send out activate code mail, and display the mail confirmation box */
/* and comback here to contine back to URL */
hPrintf("
UCSC Genome Browser
\n"
"
\n"
"
\n"
"
User %s successfully added.
\n", user);
cartRemove(cart, "hgLogin_email");
cartRemove(cart, "hgLogin_email2");
cartRemove(cart, "hgLogin_userName");
cartRemove(cart, "user");
cartRemove(cart, "token");
//backToHgSession(1);
returnToURL(1);
}
@@ -1039,30 +1106,32 @@
* dispatches to the appropriate page-maker. */
{
struct sqlConnection *conn = hConnectCentral();
cart = theCart;
if (cartVarExists(cart, "hgLogin.do.changePasswordPage"))
changePasswordPage(conn);
else if (cartVarExists(cart, "hgLogin.do.changePassword"))
changePassword(conn);
else if (cartVarExists(cart, "hgLogin.do.displayAccHelpPage"))
displayAccHelpPage(conn);
else if (cartVarExists(cart, "hgLogin.do.accountHelp"))
accountHelp(conn);
else if (cartVarExists(cart, "hgLogin.do.activateAccount"))
activateAccount(conn);
+else if (cartVarExists(cart, "hgLogin.do.displayActMailSuccess"))
+ displayActMailSuccess();
else if (cartVarExists(cart, "hgLogin.do.displayMailSuccess"))
displayMailSuccess();
else if (cartVarExists(cart, "hgLogin.do.displayLoginPage"))
displayLoginPage(conn);
else if (cartVarExists(cart, "hgLogin.do.displayLogin"))
displayLogin(conn);
else if (cartVarExists(cart, "hgLogin.do.displayLogout"))
displayLogoutSuccess();
else if (cartVarExists(cart, "hgLogin.do.signup"))
signup(conn);
else
signupPage(conn);
hDisconnectCentral(&conn);
cartRemovePrefix(cart, "hgLogin.do.");