1363e178b292e47349dfbc7b5158ac5c1ceb0e2a
angie
  Wed Dec 14 14:13:46 2016 -0800
Instead of requiring that loginValidateCookies() be called before wikiLinkUserName is called, just call it if necessary in wikiLinkUserName.  Avoids clashes with other squirrelly paths to wikiLinkUserName.  refs #17327, #12216#note-28

diff --git src/hg/lib/wikiLink.c src/hg/lib/wikiLink.c
index c41515b..4ec5eea 100644
--- src/hg/lib/wikiLink.c
+++ src/hg/lib/wikiLink.c
@@ -294,31 +294,31 @@
 /* Return the URL for the login host. */
 {
 char buf[2048];
 safef(buf, sizeof(buf), "http%s://%s/cgi-bin/hgLogin",
       loginUseHttps() ? "s" : "", wikiLinkHost());
 return cloneString(buf);
 }
 
 char *wikiLinkUserName()
 /* Return the user name specified in cookies from the browser, or NULL if 
  * the user doesn't appear to be logged in. */
 {
 if (loginSystemEnabled())
     {
     if (! alreadyAuthenticated)
-        errAbort("wikiLinkUserName: loginValidateCookies must be called first.");
+        loginValidateCookies();
     if (authenticated)
         return cloneString(getLoginUserName());
     }
 else if (wikiLinkEnabled())
     {
     char *wikiUserName = findCookieData(wikiLinkUserNameCookie());
     char *wikiLoggedIn = findCookieData(wikiLinkLoggedInCookie());
     if (isNotEmpty(wikiLoggedIn) && isNotEmpty(wikiUserName))
         return cloneString(wikiUserName);
     }
 else
     errAbort("wikiLinkUserName called when wiki is not enabled (specified "
         "in hg.conf).");
 return NULL;
 }