- Timestamp:
- 2023-03-02T23:09:46+13:00 (14 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/web/interfaces/default/transform/layouts/header.xsl
r37266 r37391 113 113 function gslogout(logout_action_url) { 114 114 if (googlesignin_client_id != '') { 115 googleLogout(); 115 //googleLogout(); 116 console.log("Need to implement new Google Identiy Logout function?????"); 116 117 } 117 118 window.location = logout_action_url; … … 208 209 209 210 <xsl:template name="addGoogleSignOn"> 210 <meta name="google-signin-client_id" content="{$googlesignin_client_id}" /> 211 212 <script> 213 <xsl:text disable-output-escaping="yes"> 214 215 function googleSigninInit() { 216 gapi.load('auth2', function() { 217 var auth2 = gapi.auth2.init({ 218 client_id: googlesignin_client_id, 219 //scope: 'email' // don't need to top up 'profile' with 'email' as not used client side (email is retrieved via GS3 Servlet) 220 }) 221 .then(function() { 222 if (typeof optGoogleAuth2InitCallback === "function"){ 223 optGoogleAuth2InitCallback(); 224 } 225 }); 226 }); 227 } 228 229 function googleLogout() { 230 var auth2 = gapi.auth2.getAuthInstance(); 231 // Use 'disconnect()' rather than 'signOut()' as this does a deeper logout 232 // that revokes the user's "Google granted" permission. 233 // This makes it easier, when using the same browser, to login into Greenstone3 234 // using a differeng Google sign-in account 235 236 auth2.disconnect().then(function () { 237 console.log("Google-authenticated User signed out"); 238 }); 239 return false; 240 } 241 </xsl:text> 242 </script> 243 <script src="https://apis.google.com/js/platform.js?onload=googleSigninInit" async="async" defer="defer" ><xsl:text> </xsl:text></script> 211 <meta name="google-signin-client_id--DEPRECATED" content="{$googlesignin_client_id}" /> 212 <script src="https://accounts.google.com/gsi/client" async="async" defer="defer" ><xsl:text> </xsl:text></script> 244 213 245 214 </xsl:template> … … 486 455 else 487 456 { 488 menu = $("< UL>")457 menu = $("<ul>") 489 458 .css("position", "absolute") 490 459 .css("display", "block") … … 523 492 var editingLink = $("<a>") 524 493 .attr("href", "javascript:;"); 525 var editingButton = $("< LI>")494 var editingButton = $("<li>") 526 495 .addClass("ui-state-default") 527 496 .css("padding", "3px")</xsl:text> … … 558 527 .attr("href", logout_javascript_call); 559 528 560 var logoutButton = $("< LI>")529 var logoutButton = $("<li>") 561 530 .css("padding", "3px") 562 531 .html("</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'menu.logout')"/><xsl:text disable-output-escaping="yes">") … … 599 568 <xsl:value-of select="@value"/> 600 569 </xsl:if> 601 </xsl:for-each> 602 570 </xsl:for-each> 603 571 </xsl:template> 604 572 … … 609 577 <xsl:variable name="url" select="/page/pageRequest/@fullURL"/> 610 578 <xsl:variable name="beforeLogout" select="substring-before($url, '&amp;logout=')"/> 611 612 579 <xsl:variable name="tmpAfter" select="substring-after($url, '&amp;logout=')"/> 580 <xsl:variable name="afterLogout" select="substring-after($tmpAfter, '&amp;')"/> 613 581 <xsl:variable name="beforeHash" select="substring-before($url, '#')"/> 614 582 <xsl:variable name="afterHash" select="substring-after($url, '#')"/>
Note:
See TracChangeset
for help on using the changeset viewer.