Gossamer Forum
Home : Products : Gossamer Links : Discussions :

GLinks 3RC - Login/Logout Toggle Issue

Quote Reply
GLinks 3RC - Login/Logout Toggle Issue
The login/logout toggle works fine when you use the dynamic pages like add, modify, newsletter, subscribe etc. but when you click on static pages like Cool, New or the category pages, the logon/logout always goes back to login which is how it was set when the page was built.

When you click on login from the static pages, you get the login screen again, it does not tell the user they are already logged in.

I know this may be a limitation of having a combo of static and dynamic pages but I'm hoping there's an easy way around with the use of some javascript perhaps. Also, clicking on login from a static page should at least tell the user if they are already logged in.

Regards,
Peter Puglisi
www.ausfreedom.com
Ultimate Freedom is our game.

Last edited by:

rocco: Apr 1, 2005, 5:28 PM
Quote Reply
Re: [rocco] GLinks 3RC - Login/Logout Toggle Issue In reply to
That's a pretty good idea actually. Your pages would have to load some javascript that check for the session cookie and if they were logged in change the login link/text to logout. The only limitation is that it will only work if javascript is enabled. I'll see if I can get something like this included in the final release.

Adrian
Quote Reply
Re: [brewt] GLinks 3RC - Login/Logout Toggle Issue In reply to
Thanks Adrian. Sounds good and keep up the great work. GT have done a great job with GLinks 3.

Regards,
Peter Puglisi
www.ausfreedom.com
Ultimate Freedom is our game.
Quote Reply
Re: [rocco] GLinks 3RC - Login/Logout Toggle Issue In reply to
This is what i have done (no js in line with GT's primary objective) though it still does not get that toggle issue right (static pages), but hitting login for a logged in user just displays that what's needed:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title><%site_title%>: User Login</title>
<%include include_common_head.html%>
<%ifnot user.Username%>
<%~set secondarynav = "featureset_nav.html"%>
<%endif%>
</head>
<body id="login">
<%include include_accessibility.html%>
<div id="wrapper">
<%include include_header.html%>
<%include include_contentheader.html%>
<div id="ocwrapper">
<div id="icwrapper" class="clear">
<%include include_leftsidebar.html%>
<div id="contentwrapper" class="shadowleft">
<div class="shadowtop"><div class="shadowtopleft"></div><div class="shadowtopright"></div></div>
<div class="shadowright">
<div id="content">

<div class="crumb"><%Links::Utils::format_title($main_title_loop, separator => $crumb_separator, no_escape_separator => $no_escape_crumb_separator, include_home => 1, link_type => 2)%></div>
<h2><%ifnot user.Username%>User Login<%else%>Already Logged In<%endif%></h2>
<%ifnot user.Username%>
<%if url%><p>You must first login before you can access that.</p><%endif%>
<p>Login to <%site_title%>:</p>

<form action="<%config.db_cgi_url%>/user.cgi" method="post">
<input type="hidden" name="login" value="1" />
<%if url%><input type="hidden" name="url" value="<%url%>" /><%endif%>

<div class="row required clear">
<label for="Username" class="name">Username:</label>
<div class="value">
<input type="text" id="Username" name="Username" value="<%if Username%><%Username%><%endif%>" class="text" />
</div>
</div>
<div class="row required clear">
<label for="Password" class="name">Password:</label>
<div class="value">
<input type="password" id="Password" name="Password" class="password" />
</div>
</div>
<div class="formsubmit">
<input type="submit" value="Login" class="submit" />
</div>
</form>

<p>
If you don't have an account, please <a href="<%config.db_cgi_url%>/user.cgi?signup_form=1">register</a>.<br />
If you've forgotten your password, we can <a href="<%config.db_cgi_url%>/user.cgi?email_pass=1">e-mail it to you</a>.
</p>
<%else%>
<h3></h3>
<h3>You Are Already Logged In So You Cannot Login Again. To Login You Have To Log Out First<br /><br /></h3>
<br /><br />
<%endif%>
</div>
</div>
<div class="shadowbottom"><div class="shadowbottomleft"></div><div class="shadowbottomright"></div></div>
</div>
<%include include_rightsidebar.html%>
</div>
</div>
<%include include_contentfooter.html%>
<%include include_footer.html%>
</div>
</body>
</html>

Thanks
HyTC
==================================
Mail Me If Contacting Privately Is That Necessary.
==================================

Last edited by:

HyperTherm: Apr 2, 2005, 2:35 AM
Quote Reply
Re: [rocco] GLinks 3RC - Login/Logout Toggle Issue In reply to
Try adding this code to the bottom of include_common_head.html
Code:
<%if not d and not user.Username~%>
<script type="text/javascript" src="<%config.build_static_url%>/utils.js"></script>
<script type="text/javascript">
//<![CDATA[
registerEvent(window, 'onload', function () {
var loginbar = document.getElementById('loginbar');
if (!loginbar)
return;
var loginlink = loginbar.firstChild;
if (loginlink.className != 'out')
return;
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
if (cookies[i].match(/<%config.user_cookie_prefix%>s=[0-9a-f]+/)) {
loginlink.href = '<%config.db_cgi_url%>/user.cgi?logout=1';
loginlink.className = 'in';
loginlink.firstChild.nodeValue = 'Logout';
break;
}
}
});
//]]>
</script>
<%~endif%>

Adrian

Last edited by:

brewt: Apr 2, 2005, 3:38 AM
Quote Reply
Re: [brewt] GLinks 3RC - Login/Logout Toggle Issue In reply to
Perfect 10!

Thanks
HyTC
==================================
Mail Me If Contacting Privately Is That Necessary.
==================================
Quote Reply
Re: [brewt] GLinks 3RC - Login/Logout Toggle Issue In reply to
I am having the same login/logout issues with static pages. I am confused on how this issue was solved above. Could you go through the steps to correct this again?
Quote Reply
Re: [jgkiefer] GLinks 3RC - Login/Logout Toggle Issue In reply to
The javascript is in place and I have tried and tried to resolve the logout link on static pages and it still show up even when the user is already logged out. Any suggestions?
Quote Reply
Re: [jgkiefer] GLinks 3RC - Login/Logout Toggle Issue In reply to
Well, the javascript is dependent on the structure/text of the login text. Have you made any changes to that portion of the template?

Adrian
Quote Reply
Re: [brewt] GLinks 3RC - Login/Logout Toggle Issue In reply to
I don't think I understand. Wnich login text? The text displayed on the login/logout link?
Quote Reply
Re: [jgkiefer] GLinks 3RC - Login/Logout Toggle Issue In reply to
If you have modified your layout, make sure you leave the <div id="loginbar"> before the <a href="<%config.db_cgi_url%>" .....</div>... that fixed it for me.
Quote Reply
Re: [garrynz] GLinks 3RC - Login/Logout Toggle Issue In reply to
No, the login and logout does not work correctly on static pages.
Code:
<div id="header">
<div id="loginbar"><a href="<%config.db_cgi_url%>/user.cgi<%if user.Username%>?logout=1<%endif%>" class="<%if user.Username%>Login Area<%else%>Login Area<%endif%>"><%if user.Username%>Login Area<%else%>Login Area<%endif%></a></div>
<div id="logo"><h1><a href="<%config.build_root_url%>"><%site_title%></a></h1></div>
</div>
Quote Reply
Re: [jgkiefer] GLinks 3RC - Login/Logout Toggle Issue In reply to
You can see the problem here:
http://kiesys.com/glinks/pages/

User=test
Pass=test

the login/logout doesn't change when you go from the login page to the home page.
Quote Reply
Re: [jgkiefer] GLinks 3RC - Login/Logout Toggle Issue In reply to
Yeah it does :) it's a bit slow to change from saying log in to logout though. What browser are you using? You have javascript turned on?
Quote Reply
Re: [garrynz] GLinks 3RC - Login/Logout Toggle Issue In reply to
Yes I have js on and I'm using Firefox. I will try it in IE.
Quote Reply
Re: [jgkiefer] GLinks 3RC - Login/Logout Toggle Issue In reply to
Everything looks okay. Can you give me admin panel access so I can debug it?

Adrian
Quote Reply
Re: [brewt] GLinks 3RC - Login/Logout Toggle Issue In reply to
I have PM'd the info to you.
Quote Reply
Re: [jgkiefer] GLinks 3RC - Login/Logout Toggle Issue In reply to
It's happening because your site redirects kiesys.com to www.kiesys.com, rendering the cookies that were generated at kiesys.com unusable on the www.kiesys.com domain. The fix was to set the Admin => User Options => user_cookie_domain option to .kiesys.com (ie *.kiesys.com has access to the cookies).

Adrian
Quote Reply
Re: [brewt] GLinks 3RC - Login/Logout Toggle Issue In reply to
Great! Thanks I would never have figured that out.Wink