92353af6dbfaf9764380a0d1e1219428cc4f942e max Wed Mar 27 04:10:25 2019 -0700 fixing hgLogin bug, this is an extended bugfix that improves the logic, the email-send function is now not redirecting anymore, refs #23202 diff --git src/hg/hgLogin/hgLogin.c src/hg/hgLogin/hgLogin.c index 636c273..372d368 100644 --- src/hg/hgLogin/hgLogin.c +++ src/hg/hgLogin/hgLogin.c @@ -350,33 +350,32 @@ { int result; result = mailViaPipe(email, subject, msg, returnAddr); if (result == -1) { hPrintf( "<h2>%s</h2>", brwName); hPrintf( "<p align=\"left\">" "</p>" "<h3>Error emailing to: %s</h3>" "Click <a href=%s?hgLogin.do.displayAccHelpPage=1>here</a> to return.<br>", hgLoginUrl, email ); + exit(0); } -else - redirectToLoginPage("hgLogin.do.displayActMailSuccess=1"); } void displayMailSuccess() /* display mail success confirmation box */ { char *sendMailTo = cartUsualString(cart, "hgLogin_sendMailTo", ""); hPrintf( "<div id=\"confirmationBox\" class=\"centeredContainer formBox\">" "<h2>%s</h2>", brwName); hPrintf( "<p id=\"confirmationMsg\" class=\"confirmationTxt\">All usernames on file (if any) for <B>%s</B> " "have been sent to that address.<BR><BR>" " If <B>%s</B> is not your registered email address, you will not receive an email." " If you can't find the message we sent you, please contact %s for help.</p>", sendMailTo, sendMailTo, returnAddr); hPrintf("<p><a href=\"%s?hgLogin.do.displayLoginPage=1\">Return to Login</a></p>\n", @@ -1056,40 +1055,36 @@ user,user,encPwd,email,accActStatus); // set the recov email only if we got one (and we only got one if the table has this field) if (!isEmpty(recovEmail)) sqlSafefAppend(query, sizeof(query), ",recovEmail='%s'", recovEmail); sqlUpdate(conn, query); if (sameWord(returnAddr, "NOEMAIL")) { redirectToLoginPage("hgLogin.do.displayLoginPage=1"); return; } setupNewAccount(conn, email, user); /* send out activate code mail, and display the mail confirmation box */ -hPrintf("<h2>%s</h2>", brwName); -hPrintf( - "<p align=\"left\">\n" - "</p>\n" - "<h3>User %s successfully added.</h3>\n", user); cartRemove(cart, "hgLogin_email"); cartRemove(cart, "hgLogin_email2"); cartRemove(cart, "hgLogin_userName"); cartRemove(cart, "user"); cartRemove(cart, "token"); +redirectToLoginPage("hgLogin.do.displayActMailSuccess=1"); } void accountHelp(struct sqlConnection *conn) /* email user username(s) or new password */ { char query[256]; char *email = cartUsualString(cart, "hgLogin_email", ""); char *username = cartUsualString(cart, "hgLogin_userName", ""); char *helpWith = cartUsualString(cart, "hgLogin_helpWith", ""); /* Forgot username */ if (sameString(helpWith,"username")) { if (sameString(email,"")) {