75593a4e317eac40b781c83718961f0eb7f84f3a
max
  Thu Aug 27 06:32:34 2026 -0700
Blue bar login and logout now return to the page they were clicked on

#Preview2 week - bugs introduced now will need a build patch to fix
The Login link in the blue bar sent everyone to the My Sessions page after
they signed in, and the Sign out and account links in the logged-in dialog
did the same, so a visitor reading a help page or looking at an item details
page lost their place. Only hgTracks was handled, as a special case.

Adds wikiLinkEncodeCurrentPageReturnUrl(), which builds a returnto for the
page the CGI is currently serving, including its query string, since the
track and item parameters of pages like hgTrackUi and hgc are not all kept in
the cart. hgTracks keeps its old behaviour of returning to hgTracks?hgsid=,
because its state is in the cart and its query string can hold a one-shot
zoom or drag. hgMenubar does the same for the static pages it is included
into, using the page path from the SSI environment.

The two checks hgLogin runs on an incoming returnto (URL shape, and the
optional login.approvedReturn host list) move to wikiLink.c so that the CGIs
building a link apply the same rules before writing it. A URL hgLogin would
refuse now becomes an ordinary login link instead of an error page: an
over-long or oddly-quoted query string costs the query string, and a host
that login.approvedReturn does not cover falls back to the old My Sessions
target. Note that with login.approvedReturn set, static-page returns need
the bare host added to the list.

Also converts the fixed 2 kB buffers in the wikiLink URL builders to
dyStrings, since a cgi-encoded return URL can nearly triple in length and
safef would have aborted.

refs #38192

diff --git src/hg/hgLogin/hgLogin.h src/hg/hgLogin/hgLogin.h
index 27345ced87f..fcff1e68850 100644
--- src/hg/hgLogin/hgLogin.h
+++ src/hg/hgLogin/hgLogin.h
@@ -1,28 +1,27 @@
 /* hgLogin.h  */
 
 /* Copyright (C) 2013 The Regents of the University of California 
  * See kent/LICENSE or http://genome.ucsc.edu/license/ for licensing information. */
 
 #ifndef hgLogin_H
 #define hgLogin_H
 
 /* ---- global variables ---- */
 #define TITLE "UCSC Genome Browser Login v"CGI_VERSION
 /* ---- hg.conf parameters used by hgLogin ---- */
 #define CFG_LOGIN_BROWSER_NAME "login.browserName"
 #define CFG_LOGIN_BROWSER_ADDR "login.browserAddr"
 #define CFG_LOGIN_MAIL_SIGNATURE "login.mailSignature"
 #define CFG_LOGIN_MAIL_RETURN_ADDR "login.mailReturnAddr"
 #define CFG_COOKIIENAME_USERNAME  "wiki.userNameCookie"
 #define CFG_COOKIIENAME_USERID  "wiki.loggedInCookie"
-#define CFG_APPROVED_HOSTS "login.approvedReturn"
 #define CFG_LOGIN_PWD_EYE_ICON "login.pwdEyeIcon"
 #endif /* hgLogin_H */