547d1ed19123e170307c724bb511e0bf6f086416 max Mon Sep 21 06:30:13 2026 -0700 hgLogin: add an "or" divider before the email-sign-in-link button too, refs #38302 diff --git src/hg/hgLogin/hgLogin.c src/hg/hgLogin/hgLogin.c index 723bed41d8a..431b4643002 100644 --- src/hg/hgLogin/hgLogin.c +++ src/hg/hgLogin/hgLogin.c @@ -60,31 +60,31 @@ char returnAddr[256]; char *hgLoginUrl = NULL; /* full absolute URL to hgLogin as seen from browser, e.g. http://genome.ucsc.edu/cgi-bin/hgLogin. Can be a relative URL /cgi-bin/hgLogin if hg.conf login.relativeLink is on. */ boolean pwdEyeIconEnabled = TRUE; /* show/hide eye icon on password fields; set from hg.conf login.pwdEyeIcon in doMiddle() */ boolean recovEmailVerifyOk = FALSE; /* TRUE when gbMembers has the recovEmailVerified column, so a confirmed recovery address can be told apart from one that was merely typed into the signup form. Set in doMiddle() after the auto-upgrade; FALSE on a mirror where the ALTER failed. */ /* for earlyBotCheck() function at the beginning of main() */ #define delayFraction 1.0 /* standard penalty is 1.0 for most CGIs */ /* Forward declarations for functions used before their definitions. */ static void printSocialButtons(boolean dividerAbove, boolean dividerBelow, char *action); -static void printEmailLinkButton(); +static void printEmailLinkButton(boolean dividerAbove); static boolean emailLinkEnabled(); static boolean recovEmailChangeEnabled(); void changeRecovEmailPage(struct sqlConnection *conn); static void printUsernameNote(); void emailLinkPage(struct sqlConnection *conn); void displayLoginPage(struct sqlConnection *conn); void displayAccHelpPage(struct sqlConnection *conn); void completeAccountPage(struct sqlConnection *conn); void sendEmailLink(struct sqlConnection *conn); static void loginAndReturn(struct sqlConnection *conn, char *userName, uint idx); static boolean pendingIdentityValid(); /* ---- Global helper functions ---- */ char *browserName() /* Return the browser name like 'UCSC Genome Browser' */ @@ -957,31 +957,31 @@ "<a class=\"forgotLink\" href=\"%s?hgLogin.do.displayAccHelpPage=1&hgLogin_helpWith=password\">Forgot password</a>" "</div>" "\n" "<div class=\"formControls\">" " <input type=\"submit\" name=\"hgLogin.do.displayLogin\" value=\"Login\" class=\"largeButton\">" " <a href=\"%s\" class=\"cancelButton\">Cancel</a>" "</div>" , hgLoginUrl, getReturnToUrlForAttr()); if (pwdEyeIconEnabled) { printPwdToggleJS(); jsOnEventById("click", "pwdEyeIcon", "togglePwdVisibility('password','pwdEyeSlash');"); } cartSaveSession(cart); hPrintf("</form>\n"); -printEmailLinkButton(); +printEmailLinkButton(TRUE); printSocialButtons(TRUE, FALSE, "Sign in"); hPrintf( "</div><!-- END - loginBox -->" "\n" "\n" "</body>" "</html>"); } void activateAccount(struct sqlConnection *conn) /* activate account */ { char query[256]; char *token = cgiUsualString("token", ""); char *username = cgiUsualString("user",""); @@ -2226,35 +2226,38 @@ } static boolean recovEmailChangeEnabled() /* Return TRUE if users may set or change their own recovery email address. Needs working * outbound mail to confirm the new address, a login.cookieSalt to sign the confirmation link, * and the recovEmailVerified column to record the answer in, so all three are required on top * of the admin turning it on with login.recovEmailChange=on in hg.conf. */ { if (!cfgOptionBooleanDefault(CFG_LOGIN_RECOV_EMAIL_CHANGE, FALSE)) return FALSE; if (!recovEmailVerifyOk || isEmpty(cfgOption(CFG_LOGIN_COOKIE_SALT))) return FALSE; return !sameWord(returnAddr, "NOEMAIL"); } -static void printEmailLinkButton() -/* Print a grey button that opens the passwordless email-link login page, if enabled. */ +static void printEmailLinkButton(boolean dividerAbove) +/* Print a grey button that opens the passwordless email-link login page, if enabled, + * optionally preceded by an "or" divider. */ { if (!emailLinkEnabled()) return; +if (dividerAbove) + hPrintf("<div class=\"orDivider\"><span>or</span></div>"); hPrintf("<a class=\"socialButton\" href=\"%s?hgLogin.do.emailLinkPage=1\">" "Email me a sign-in link</a>", hgLoginUrl); } static void printUsernameNote() /* Print a short hint, shown wherever a new username is chosen, explaining that the username * shows up in every short link the user later creates, so it should be short and easy to type. */ { hPrintf("<p style=\"font-size:0.9em\">Note: your username becomes part of every short link " "you create later (for example <code>%s/s/<b>username</b>/MySession</code>), so choose " "something short and easy to type.</p>", brwAddr); } static void loginAndReturn(struct sqlConnection *conn, char *userName, uint idx) /* Set the permanent login cookies for userName and bounce back to the returnto URL.