Advertisement:

Author Topic: Forever login?  (Read 2368 times)

Offline eric1234

  • Full Member
  • ***
  • Posts: 660
Forever login?
« on: November 07, 2013, 12:57:26 PM »
My users complained that they logged in but after sometime browsing the forum or leave it idle, it auto log out again. How to make every users forever login like in this site?

Online margarett

  • Support Specialist
  • SMF Super Hero
  • *
  • Posts: 11,015
  • Gender: Male
Re: Forever login?
« Reply #1 on: November 07, 2013, 01:02:02 PM »
If nothing is wrong, you should get logged in "forever" if they check the correct option when they login...

Can you reproduce this yourself or are they just telling you?

You can also change the default cookie duration in your ACP to a huge number so that, if they don't check the option, they still get a big number so it would be like "forever"
Bruno Alves a.k.a "margarett"

Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

Quote
Over 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Offline eric1234

  • Full Member
  • ***
  • Posts: 660
Re: Forever login?
« Reply #2 on: November 07, 2013, 01:25:00 PM »
If nothing is wrong, you should get logged in "forever" if they check the correct option when they login...

Can you reproduce this yourself or are they just telling you?

You can also change the default cookie duration in your ACP to a huge number so that, if they don't check the option, they still get a big number so it would be like "forever"
I also cant reproduce this myself :(

Default cookies? you mean Minutes to stay logged in?

Online margarett

  • Support Specialist
  • SMF Super Hero
  • *
  • Posts: 11,015
  • Gender: Male
Re: Forever login?
« Reply #3 on: November 07, 2013, 01:28:00 PM »
index.php?action=admin;area=serversettings;sa=cookie;

"Default login cookies length (in minutes)"

;)
Bruno Alves a.k.a "margarett"

Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

Quote
Over 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Offline Krash

  • Support Specialist
  • SMF Hero
  • *
  • Posts: 3,716
  • Mad as a box full of frogs.
Re: Forever login?
« Reply #4 on: November 07, 2013, 01:33:27 PM »

You can edit the login templates to remove the session length option and hardcode all logins to forever.


Offline eric1234

  • Full Member
  • ***
  • Posts: 660
Re: Forever login?
« Reply #5 on: November 07, 2013, 01:38:29 PM »

You can edit the login templates to remove the session length option and hardcode all logins to forever.


Mind to elaborate on how to do that?

index.php?action=admin;area=serversettings;sa=cookie;

"Default login cookies length (in minutes)"

;)
Checking it now

Offline Krash

  • Support Specialist
  • SMF Hero
  • *
  • Posts: 3,716
  • Mad as a box full of frogs.
Re: Forever login?
« Reply #6 on: November 07, 2013, 03:07:10 PM »

You remove the 'Forever' dropdown in the header login in index.template.php, and add -

Code: [Select]

<input type="hidden" name="cookielength" value="-1" />


In Login.template.php, remove 'Minutes to stay logged in:' and 'Always stay logged in:', and add the same line to the code.  You have to do this in 3 or 4 places.  Search 'cookielegth' to find them all.


Offline eric1234

  • Full Member
  • ***
  • Posts: 660
Re: Forever login?
« Reply #7 on: November 08, 2013, 12:00:29 PM »

You remove the 'Forever' dropdown in the header login in index.template.php, and add -

Code: [Select]

<input type="hidden" name="cookielength" value="-1" />


In Login.template.php, remove 'Minutes to stay logged in:' and 'Always stay logged in:', and add the same line to the code.  You have to do this in 3 or 4 places.  Search 'cookielegth' to find them all.
How to remove??

remove the 'Forever' dropdown in the header login in index.template.php
Code: [Select]
<select name="cookielength">
<option value="60">', $txt['one_hour'], '</option>
<option value="1440">', $txt['one_day'], '</option>
<option value="10080">', $txt['one_week'], '</option>
<option value="43200">', $txt['one_month'], '</option>
<option value="-1" selected="selected">', $txt['forever'], '</option>

 remove 'Minutes to stay logged in:' and 'Always stay logged in:'
Code: [Select]
<dt>', $txt['mins_logged_in'], ':</dt>
<dd><input type="text" name="cookielength" size="4" maxlength="4" value="', $modSettings['cookieTime'], '"', $context['never_expire'] ? ' disabled="disabled"' : '', ' class="input_text" /></dd>
<dt>', $txt['always_logged_in'], ':</dt>
<dd><input type="checkbox" name="cookieneverexp"', $context['never_expire'] ? ' checked="checked"' : '', ' class="input_check" onclick="this.form.cookielength.disabled = this.checked;" /></dd>';

by the way, is it by changing the code , everyone in my forum including myself will be forever logged in? But why the current system even when we ticked always stayed logged in , still eventually after some time will be auto log out?
« Last Edit: November 08, 2013, 02:29:13 PM by eric1234 »

Offline Kindred

  • The Mean One
  • Project Manager
  • SMF Master
  • *
  • Posts: 39,644
  • Gender: Male
  • Red Sox WIN!
    • wagner999 on Facebook
    • Kindred-999 on GitHub
    • www.linkedin.com/in/wdwagner/ on LinkedIn
    • @Kindred_999 on Twitter
Re: Forever login?
« Reply #8 on: November 08, 2013, 09:19:02 PM »
no. If you have the forever chosen, you will NOT be logged out "after some time"

unless you delete your browser cookies
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support forums.  Thank you.

Offline eric1234

  • Full Member
  • ***
  • Posts: 660
Re: Forever login?
« Reply #9 on: November 09, 2013, 01:00:35 AM »
no. If you have the forever chosen, you will NOT be logged out "after some time"

unless you delete your browser cookies
"after some time" is how long?
« Last Edit: November 09, 2013, 01:26:27 AM by eric1234 »

Offline oridyne

  • Semi-Newbie
  • *
  • Posts: 48
  • Gender: Male
    • @@BBBBForum on Twitter
    • Big Bang Burger Bar
Re: Forever login?
« Reply #10 on: November 09, 2013, 04:31:29 AM »
no. If you have the forever chosen, you will NOT be logged out "after some time"

unless you delete your browser cookies


I have noticed recently that both on my phone and PC I am repeatedly having to re-logon to my forum despite having "Forever" checked and no changes to settings on either device affecting cookies.


Whether this is as a consequence of the recent update I am not sure but it has been working fine. I use Chrome on my PC and Dolphin on my Android smartphone if that helps.
<*> I'm dangerous when I know what I'm doing <*>

Big Bang Burger Bar

Offline Kindred

  • The Mean One
  • Project Manager
  • SMF Master
  • *
  • Posts: 39,644
  • Gender: Male
  • Red Sox WIN!
    • wagner999 on Facebook
    • Kindred-999 on GitHub
    • www.linkedin.com/in/wdwagner/ on LinkedIn
    • @Kindred_999 on Twitter
Re: Forever login?
« Reply #11 on: November 09, 2013, 09:16:33 AM »
eric1234,

I don't think you are actually paying attention.  I QUOTED your statement of "after some time" (which is why it was in quotes.
After some time is NEVER if you have a standard, unmodified installation and don't delete cookies.
period.
What you are experiencing suggests that either you have messed around with the code, in which case, all bets are off and it could be doing anything, since we have no idea how you have screwed up the code or that you are deleting your cookies on your local browser - which will, indeed end your session.

oridyne,
see above.
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support forums.  Thank you.

Offline Krash

  • Support Specialist
  • SMF Hero
  • *
  • Posts: 3,716
  • Mad as a box full of frogs.
Re: Forever login?
« Reply #12 on: November 09, 2013, 02:00:33 PM »

How to remove??

Just comment out or delete those lines.

Quote
by the way, is it by changing the code , everyone in my forum including myself will be forever logged in? But why the current system even when we ticked always stayed logged in , still eventually after some time will be auto log out?

By setting cookielength = -1, users stay logged in until they log out, or cookie is deleted.


Offline oridyne

  • Semi-Newbie
  • *
  • Posts: 48
  • Gender: Male
    • @@BBBBForum on Twitter
    • Big Bang Burger Bar
Re: Forever login?
« Reply #13 on: November 09, 2013, 03:51:39 PM »
eric1234,

I don't think you are actually paying attention.  I QUOTED your statement of "after some time" (which is why it was in quotes.
After some time is NEVER if you have a standard, unmodified installation and don't delete cookies.
period.
What you are experiencing suggests that either you have messed around with the code, in which case, all bets are off and it could be doing anything, since we have no idea how you have screwed up the code or that you are deleting your cookies on your local browser - which will, indeed end your session.

oridyne,
see above.


Firstly my bad, I replied to this having seen the Forever login title, missing that it was for SMF 2.0 where I am running 1.1.19.


Whilst I have multiple mods, and have had to make some minor changes in the past to mod code to fix issues with my site, none of this has been done recently and certainly not since the recent update. The forever login has been working fine, though recently, not sure if it coincided with the security update I'm afraid, I have noticed this issue happening on my devices connecting to the forum.


I have made no browser config changes, no code changes but yet I see this happening despite your insistence. I merely posted to confirm that someone else was seeing the same issue as the OP. Not a problem for me to keep logging in, just thought I would try and help as there may be an issue.


Just because something should work does not mean there is not a problem, especially with such a complicated bit of code as SMF, it is always far to easy to miss something.
That said, I could not code anything as complicated as this and concede to your superior knowledge of your own product for which I thank the entire dev team for their continued efforts it is much appreciated.


I will just resign myself to logging in more frequently and bow gracefully out of this conversation.



<*> I'm dangerous when I know what I'm doing <*>

Big Bang Burger Bar

Offline Kindred

  • The Mean One
  • Project Manager
  • SMF Master
  • *
  • Posts: 39,644
  • Gender: Male
  • Red Sox WIN!
    • wagner999 on Facebook
    • Kindred-999 on GitHub
    • www.linkedin.com/in/wdwagner/ on LinkedIn
    • @Kindred_999 on Twitter
Re: Forever login?
« Reply #14 on: November 09, 2013, 04:20:43 PM »
oridyne,

the cookie/login for SMF 1.1.x has been working for everyone for the past 8 years....     so, if you have an issue, it would seem to be very specific to your site.
Not saying there is not an issue, just saying that the issue is NOT in the SMF core code.
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support forums.  Thank you.