Frequently Asked Questions

Apr 18, 2024 - 01:26am

 [F] Frequently Asked Questions  / Common Problems and Solutions  / Common User Interface Questions  /

Logout Page Still Shows User Name, Status, etc

Rate This FAQ
Rating: ***½ (based on 2 votes)

Created On: 23 Jun 2003 2:02 pm
Last Edited: 27 May 2005 9:03 am

Question Printer Friendly

When a user clicks "logout" on my site, they still see their user name (or other user specific details) at the top of the page.

If they reload the page it goes away.

Answer

The following is for versions prior to 5.0

With version 5.0 you can use the "Clean Logout" plugin which automates the basic process outlined below.

The page that is generated when you select the logout link is constructed and rendering starts before the user is officially logged out.

Technically, the logout occurs after rendering of the %% banner %%. If you do not like this behavior you could of course customize the %% macro logout %% (copy it from webextn.tpl into webx.tpl and customize there), and move the commands that do the actual logging out to the beginning of the macro.

However, if your site uses cookies, this will not help. The problem is how browsers process the header information that sets cookie values. A browser will not officially clear the cookie until the entire page is rendered. So during that rendering the cookie is still active and to web crossing the user still looks logged in by the very presence of a valid cookie.

So what to do? All you can do really is generate some sort of intermediate page that will complete the cookie clearing, and then load the official "logout" page. For example, the following v4.1 logout macro uses this scheme:

Example
This is unsupported and may not work on early versions of Web Crossing.

<!------------------- logout ------------------------------>
%% macro logout %%
%% certificateLogout %%
%% if userUseCookies %%
	%% if siteCookieDomain %%
		%% set domain siteCookieDomain %%
	%% else %%
		%% set domain siteHost %%
	%% endif %%
	%% addResponseHttp( "Set-cookie: webxUser=expiredSession; path=/" ) %%
	%% addResponseHttp( "Set-cookie: webxUser=expiredSession; expires=Fri, 31-Dec-2010 23:59:59 GMT; domain=" & domain & "; path=/" ) %%
<HTML><HEAD>
<!-- Page produced by Web Crossing(tm)/%% platform %%-%% version %% (http://webcrossing.com/) for %% siteLicensee %%-->
<!-- User interface (c)Copyright 1995-2002 by Web Crossing, Inc. All rights reserved.-->
<meta HTTP-EQUIV="Refresh" CONTENT="1; URL=%% urlBase %%logout@@%% location %%">
<title>%% siteTitle %% - Logging Out...</title></HEAD>
<H1>Logging Out...</H1>
<H2>Neutralizing Cookie...</H2>
<H3>If page does not automatically refresh, click <a href=""%% urlBase %%logout@@%% location %%">here</a>.</h3>
</body></html>
%% return %%
%% endif %%
<HTML><HEAD>
<!-- Page produced by Web Crossing(tm)/%% platform %%-%% version %% (http://webcrossing.com/) for %% siteLicensee %%-->
<!-- User interface (c)Copyright 1995-2002 by Web Crossing, Inc. All rights reserved.-->
<title>%% siteTitle %% - Logged Out %% pathTitle %%</title></HEAD>
<body %% background %%>%% preparedFor %%%% banner %%
<h1>Logged Out</h1><p>
You've been logged out - please visit again soon!
<form name=loginForm method="POST" action="%% urlBase %%23@%% certificate %%@50@%% location %%" name=login
onSubmit="if( window.submitted ) return false; window.submitted = true; return true;">%%nop%%
<table>
<tr><td>Your name or email address:</td>
<td><input name="username" type=text size=30 maxlength=50
%% if siteHasPasswordForm %%
	onblur="if( !window.submitted && this.value != '' ){ this.form.submit(); window.submitted = true; }"
%% endif %%><tr><td></tr>%%nop%%
%% if !siteHasPasswordForm %%
	<tr><td>Your password:</td>
	<td><input name="password" type=password size=30 maxlength=50
		onblur="if( !window.submitted && this.form.username.value != '' && this.value != '' )
			{ this.form.submit(); window.submitted = true; }"></td></tr>%%nop%%
%% endif %%
</table>
<br>%% if imgButton %%<input type=image NAME=" Login " ALT=" Login " BORDER=0 align=middle src="%% siteImages %%/login.gif" %% pictSizeButton %%>%%nop%%
%% else %%<input type=submit value=" Login "> %% endif %%
%% if siteCanAutoRegister  %%
	<a href="%% urlBase %%18@@%%actionPath%%"><img align=middle alt=" New User Registration " border=0 src="%% siteImages %%/newuser.gif" %% pictSizeButton %%></a>%%nop%%
%% endif %%
%% if siteAllowsGuests %%
	<a href="%% urlBase %%13@@%%location%%"><img alt=" Guest Access " align=middle border=0 src="%% siteImages %%/gstlgin.gif" %% pictSizeButton %%></a>%%nop%%
%% endif %%
%% if siteHasEmailServices %%
	<a href="%% urlBase %%lostPassword@@"><img alt=" Lost Password " align=middle border=0 src="%% siteImages %%/lstpswd.gif" %% pictSizeButton %%></a>%%nop%%
%% else %%
	<a href="mailto:%% sysopEmail %%"><img alt=" Lost Password " align=middle border=0 src="%% siteImages %%/lstpswd.gif" %% pictSizeButton %%></a>%%nop%%
%% endif %%
<a href="mailto:%% sysopEmail %%"><img alt=" Email to Sysop " align=middle border=0 src="%% siteImages %%/emlsysop.gif" %% pictSizeButton %%></a>%%nop%%
</form>
<SCRIPT language="Javascript"><!--
document.forms.loginForm.username.focus();
window.submitted = false;
//-->
</SCRIPT>
%% if !siteHasPasswordForm %%
	<p>(You can <tt>Tab</tt> out of the password field to login automatically.)
%% endif %%
%% footer %%
</body></html>
%% endmacro %%