Changeset 37408
- Timestamp:
- 2023-03-05T16:40:18+13:00 (2 weeks ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/web/interfaces/default/transform/layouts/header.xsl
r37403 r37408 530 530 </xsl:text></xsl:if><xsl:text disable-output-escaping="yes"> 531 531 532 // Need to check for the situation where the user immediately logs out, having just logged in 533 // Given how cgi-args are used, this sequence of use there is still 'googleidentity-signin=1' in the 534 // the URL, which we don't want. 535 var has_googleidentity_signin = (url.indexOf('googleidentity-signin=') >= 0); 536 if (has_googleidentity_signin) { 537 url = url.replace(/(&|\?)googleidentity-signin=\d+(&|$)/g, "$1") 538 } 539 532 540 var logout_url_action = url + (hasQueryString ? "&" : "?") + "logout=" + (hashPart ? hashPart : ""); 533 541 var logout_javascript_call = "javascript:gslogout('"+logout_url_action+"')"; … … 613 621 <xsl:if test="$afterHash != ''">#<xsl:value-of select="$afterHash" /></xsl:if> 614 622 </xsl:template> 623 624 625 <xsl:template name="generateGoogleIdentityLoginURL"> 626 <xsl:param name="servletProtocol"/> 627 <xsl:param name="baseURL"/> 628 <xsl:param name="redirectURL"/> 629 630 <xsl:variable name="beforeLogout" select="substring-before($redirectURL, '&amp;logout=')"/> 631 <xsl:variable name="tmpAfter" select="substring-after($redirectURL, '&amp;logout=')"/> 632 <xsl:variable name="afterLogout" select="substring-after($tmpAfter, '&amp;')"/> 633 <xsl:variable name="beforeHash" select="substring-before($redirectURL, '#')"/> 634 <xsl:variable name="afterHash" select="substring-after($redirectURL, '#')"/> 635 <!-- Get rid of any lingering &logout= already in the redirectURL. 636 But retain anything before and after it (the after portion would start with &). 637 Can't use fn:replace() as it's only been defined since XSLT 2.0. We use XSLT 1.x --> 638 <xsl:variable name="baseRedirectURL"> 639 <xsl:choose> 640 <xsl:when test="$beforeLogout != ''"><xsl:value-of select="$beforeLogout" /></xsl:when> 641 <xsl:otherwise><xsl:value-of select="$redirectURL" /></xsl:otherwise> 642 </xsl:choose> 643 <xsl:if test="$afterLogout != ''">&<xsl:value-of select="$afterLogout" /></xsl:if> 644 </xsl:variable> 645 646 <!-- Output the login link: the current page's URL (with any lingering logout suffix removed) 647 followed by ?{$redirectURL}&googleidentity-signin=1 or &{$redirectURL}&googleidentity-signin=1 followed by any # portion of the current page's URL --> 648 <xsl:value-of select="$servletProtocol"/> 649 <xsl:text>:</xsl:text> 650 <xsl:value-of select="$baseURL"/> 651 <xsl:choose> 652 <xsl:when test="$beforeHash != ''"><xsl:value-of select="$beforeHash" /></xsl:when> 653 <xsl:otherwise><xsl:value-of select="$baseRedirectURL" /></xsl:otherwise> 654 </xsl:choose> 655 <xsl:choose> 656 <xsl:when test="contains($baseRedirectURL, '?')"><xsl:text>&googleidentity-signin=1</xsl:text></xsl:when> 657 <xsl:otherwise><xsl:text>?googleidentity-signin=1</xsl:text></xsl:otherwise> 658 </xsl:choose> 659 <xsl:if test="$afterHash != ''">#<xsl:value-of select="$afterHash" /></xsl:if> 660 </xsl:template> 661 662 615 663 616 664 <xsl:template name="LoginoutLink">
Note:
See TracChangeset
for help on using the changeset viewer.