Uncheck 'Next time automatically sign-in' by default...

rated by 0 users
This post has 3 Replies | 2 Followers

Not Ranked
Posts 23
Points 300
matthew_ Posted: Fri, Apr 18 2008 11:13 AM

Hi, everyone...

I've noticed a few people having issues with unchecking the automatic login checkbox across various versions, and was hoping for some assistance.

I'm running the latest CS2007 build, but changing the checkbox's value to 'false' on the login.aspx page doesn't produce the desired result.

I noticed this code in a similar thread:

<script language="C#" runat="server">
protected override void OnPreRender (EventArgs e)
{
   if (this.Page.Request.Cookies["CommunityServer-AutoLoginCookie"] == null)
      autoLogin.Checked = false;
}
</script>

But it produces the dreaded 'Oops...' page upon implementation.

Any suggestions re: how to uncheck this by default - perhaps by editing the cookie's default data?

Thanks!

Top 10 Contributor
Posts 5,292
Points 49,180
CS Developers

Are you attempting to make it so the button defaults to being unchecked, or are experiencing an issue where even when you uncheck the Remember Me checkbox, you are still being remembered?

There was a bug where if you had previously checked remember me, it would always remember you (even if you chose not to later on) because it was overriding the user's option when processing the login.  This bug was fixed with in CS 2008 and the CS 2007.1 SP1 we released the day after CS 2008 RTM'd.

If you are trying to make it default to not being checked, then it looks like there is somewhat of an issue with that.  The default value of the checkbox is ignored, since even when an AutoLoginCookie doesn't exist, the default internally in the code is true, and it gets set overriding the default in the aspx page.  I've logged this as item number 581 to look at for correcting in a service pack.

In the meantime, try doing the following:

  1. At the top of the theme's login.aspx page, add this:  <%@ Import namespace="CommunityServer.Controls"%>
  2. On the <CSControl:LoginForm main line, set an id for it.  I set the id="loginForm"
  3. Add the following code block within the page:
<script language="C#" runat="server">
protected override void OnPreRender (EventArgs e) 
{
   if (this.Page.Request.Cookies["CommunityServer-AutoLoginCookie"] == null)
  ((CheckBox)CSControlUtility.Instance().FindControl(loginForm, "autoLogin")).Checked = false;
}
</script>
The main reason your code didn't work was because the autoLogin control is a child of another control.  The script block executes within the main aspx page and not any of the child controls (even if you place it within a child control).  Using loginForm.FindControl() doesn't work either because of how CS dynamically determines the templates.  But, using CSControlUtility allows you to find the control within a Chameleon control without a problem.

  • | Post Points: 20
Not Ranked
Posts 23
Points 300
matthew_ replied on Fri, Apr 18 2008 2:54 PM

Hi, Ken...

Thanks for the help. I've implemented this solution and early returns seem to indicate it's working as planned for defaulting to an unchecked box.

Thanks again for the speedy reply!

 

  • | Post Points: 5
Not Ranked
Posts 23
Points 300
matthew_ replied on Mon, Apr 21 2008 1:56 PM

Unfortunately, while this approach does succeed in leaving the checkbox unchecked by default, it still functions as if the user has chosen to automatically sign in - regardless of the field's selection.

Logging in anonymously, I do see an unchecked box by default, however after signing in and closing/restarting the browser I'm automatically signed in again. If I sign out, then return to the login screen, the box is now checked by default.

Would this be an instance of the cookie still being written with the automatic login enabled?

I'd appreciate any help on the matter - thanks!

Page 1 of 1 (4 items) | RSS
Powered by Community Server (Commercial Edition), by Telligent Systems

Copyright© 2008 Telligent Systems Inc. All rights reserved
CommunityServer.com  •  Telligent.com