38535c51763df43a76e29658192a7917a92ec822 chinhli Mon Apr 30 15:59:44 2012 -0700 Finish confirmationScreen. diff --git src/hg/hgLogin/hgLogin.c src/hg/hgLogin/hgLogin.c index fc82f7c..9739596 100644 --- src/hg/hgLogin/hgLogin.c +++ src/hg/hgLogin/hgLogin.c @@ -28,67 +28,117 @@ char *excludeVars[] = { "submit", "Submit", "debug", "fixMembers", "update", "hgLogin_password", "hgLogin_password2", "hgLogin_newPassword1", "hgLogin_newPassword2", NULL }; /* The excludeVars are not saved to the cart. (We also exclude * any variables that start "near.do.") */ /* ---- Global variables. ---- */ struct cart *cart; /* This holds cgi and other variables between clicks. */ char *database; /* Name of genome database - hg15, mm3, or the like. */ struct hash *oldCart; /* Old cart hash. */ char *errMsg; /* Error message to show user when form data rejected */ /* -------- utilities functions --- */ - -void sendMail(char *email, char *subject, char *msg) +void displayMailSuccess() +/* display mail success msg, and set cookie */ +{ +char *email = cartUsualString(cart, "hgLogin_email", ""); +char *obj=cartUsualString(cart, "hgLogin_helpWith", ""); +//safecpy(obj, sizeof(obj),object); +hPrintf( +"
" +"\n" +"

UCSC Genome Browser

" +"

An email has been sent to " +" %s containing %s...

" +"\n" +"

Return to Login

" +, email +, obj +); +// backToDoLoginPage(12); +} +void sendMail(char *email, char *subject, char *msg, char *object) { +char *hgLoginHost = hgLoginLinkHost(); char cmd[256]; safef(cmd,sizeof(cmd), // "echo 'Hello from your favoriate browser at: %s %s ' | mail -s \"Greeting form UCSC Genome Browser\" %s" // , msg, httpLink, email); //"echo '%s' | mail -s \"Greeting from uCSC\" %s" "echo '%s' | mail -s \"%s\" %s" , msg, subject, email); int result = system(cmd); if (result == -1) { hPrintf( "

GSID HIV Data Browser

" "

" "

" "

Error emailing password to: %s

" "Click here to return.
" , email ); } else { +/*************************** old mail ************** hPrintf( "

GSID HIV Data Browser

" "

" "

" "

Password has been emailed to: %s

" "Click here to return.
" , email ); +********************************** old mail ****/ +/************************* +hPrintf( +"
" +"\n" +"

UCSC Genome Browser

" +"

An email has been sent to " +" $email containing %s...

" +"\n" +"

Return to Login

" +"\n" +"
" +"\n" +, object); +**********************/ +cartSetString(cart, "hgLogin_helpWith", "password"); +hPrintf( +"" +, hgLoginHost +); + +cartSetString(cart, "hgLogin.do.displayMailSuccess", "1"); +//displayMailSuccess("password"); +//return; } } - void activateAccount(struct sqlConnection *conn) /* activate user account */ { struct sqlResult *sr; char **row; char query[256]; char *token = cgiUsualString("hgLogin_activateAccount", ""); safef(query,sizeof(query),"Token is %s ", token); if (!sameString(token,"")) { freez(&errMsg); errMsg = cloneString(query); displayLoginPage(conn); return; } @@ -754,33 +804,33 @@ hPrintf( "
" "\n" "

UCSC Genome Browser

" "\n" "

Having trouble signing in?

" "\n" "
" "\n" "

%s

" "\n" , errMsg ? errMsg : "" ); hPrintf( "

" -"
" +"
" "
" -"
" +"
" "
" "\n" "
" "\n" ); hPrintf( "
" "" "" "
" "\n" "
" " " "  Cancel" "
" @@ -804,31 +854,31 @@ displayAccHelpPage(conn); return; } /* TODO: validate the email address is in right format */ /* Username selcted? */ char *helpWith = cartUsualString(cart, "helpWith", ""); if (sameString(helpWith,"username")) { char subject[256]; char email[256]="chinhli@soe.ucsc.edu"; char msg[256]; char httpLink[256]="Visit http://www.genome.ucsc.edu "; safef(subject, sizeof(subject),"Greeting form UCSC about %s", email); safecpy(msg, sizeof(msg), "Hello from your favoriate browser at UCSC. "); safecat (msg, sizeof(msg), httpLink); - sendMail(email, subject, msg); + sendMail(email, subject, msg, "password"); freez(&errMsg); errMsg = cloneString("Forgot user name selected!"); displayAccHelpPage(conn); return; } if (sameString(helpWith,"password")) { freez(&errMsg); errMsg = cloneString("Forgot password selected!"); displayAccHelpPage(conn); return; } displayAccHelpPage(conn); return; } @@ -1164,30 +1214,32 @@ lostPasswordPage(conn); else if (cartVarExists(cart, "hgLogin.do.lostPassword")) lostPassword(conn); else if (cartVarExists(cart, "hgLogin.do.changePasswordPage")) changePasswordPage(conn); else if (cartVarExists(cart, "hgLogin.do.changePassword")) changePassword(conn); else if (cartVarExists(cart, "hgLogin.do.displayUserInfo")) displayUserInfo(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")) accountHelp(conn); +else if (cartVarExists(cart, "hgLogin.do.displayMailSuccess")) + displayMailSuccess(conn); 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.");