membercontrols - I want user sesion to time out after 10 minutes! Options
claus_n
Posted: Monday, February 25, 2008 12:00:57 PM
Rank: Newbie

Joined: 8/22/2006
Posts: 9
The membercontrols does not log out users. Even when I close explorer and open it again several days later I'm still logged in to the user area I created.

How do I get my users automatically logged off after 10 minutes?


regards,

Claus N.
Carl
Posted: Monday, March 17, 2008 9:50:09 AM
Rank: Enthusiast

Joined: 11/1/2007
Posts: 32
By rewriting the Umbraco Member Controls.
The method so neatly called ButtonForumCreate_Click, logs in the user at the click of the login button. It uses the default "Member.AddMemberToCache" implementation that creates a cookie that lives for 365 days.
:dontgetit:
LostInSwiss
Posted: Monday, March 17, 2008 10:31:18 AM

Rank: Devotee

Joined: 3/31/2007
Posts: 66
Location: Switzerland
You can hack this with javascript. Below is some JS that will read the umbracoMemberId cookie and rewrite it as a session cookie meaning the user gets logged off when they close their browser. Note may not work on all browsers.


Code:

<script type="text/javascript">
<!--
function ReadCookie(cookieName) {
var theCookie=""+document.cookie;
var ind=theCookie.indexOf(cookieName);
if (ind==-1 || cookieName=="") return "";
var ind1=theCookie.indexOf(';',ind);
if (ind1==-1) ind1=theCookie.length;
return unescape(theCookie.substring(ind+cookieName.length+1,ind1));
}
document.cookie = "umbracoMemberId="+ReadCookie('umbracoMemberId')+";-10;path=/";
-->
</script>
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.