The forum of the forums

Would you like to react to this message? Create an account in a few clicks or log in to continue.
The forum of the forums
4 posters

    Forum logs me out around every hour

    ThePumpkin
    ThePumpkin
    New Member


    Female Posts : 15
    Reputation : 1
    Language : Bulgarian

    Solved Forum logs me out around every hour

    Post by ThePumpkin April 4th 2024, 8:12 pm

    Hello!
    Unsure if my topic is for this category, but I will post it here.
    I know that every month the forum logs out the accounts, but this month I'm getting kicked out of my account every hour or so (today at least 4 times). When I become "inactive" (refresh forum for hour or so), it just kicks me out.
    The forum automatically have the option for auto log in every time you open enabled. Its checked, so its not that too.

    I decided to test that if its something related to my browser (cleared cache and etc), but no - I get kicked out from Opera, Google Chrome and Brave (none of other members of the forum have that problem...on phone - its all fine too, no random log outs). I got twice, i believe, kicked out from this forum here too, so its not just my forum that make the problem, seems like.

    First I though it may be some bug or something, or like the usual "every month it logs us out" but seems like its not that. I dont know if new added code for Switch Accounts can be related to this problem, so i will provide the code too. But again - noone other of my members experience this. I saw another recent topics with same problem.

    This is the code for switch accounts widget:

    Code:
    <script type="text/javascript">
            function switch_accounts() {
            jQuery.get(document.getElementById('logout').href, function() {
            jQuery.post('/login', 'login=1&username='+document.getElementById('switch_uname').value+'&password='+document.getElementById('switch_pass').value, function () {
            window.location.reload();
            });
            });
            }
            </script>       
    <div align="center">
                          
       <hr /><input id="switch_uname" type="text" /> <input id="switch_pass" type="password" />         
       <hr /><input type="button" value="Смени" onclick="switch_accounts();" />         
       <hr />
    </div>

    Link to the forum as i assume you would like to inspect: https://odnovreme.forumotion.eu
    Version phpBB2.
    Thanks in advance for help and will keep updated if another forum (beside the provided one) kicks me out after some time.
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51554
    Reputation : 3523
    Language : English
    Location : United States

    Solved Re: Forum logs me out around every hour

    Post by SLGray April 4th 2024, 10:40 pm

    Do you have any JavaScripts, modified templates, etc?   If yes, do the issue disappears when you turn of the modifications?



    Forum logs me out around every hour Slgray10

    When your topic has been solved, ensure you mark the topic solved.
    Never post your email in public.
    ThePumpkin
    ThePumpkin
    New Member


    Female Posts : 15
    Reputation : 1
    Language : Bulgarian

    Solved Re: Forum logs me out around every hour

    Post by ThePumpkin April 5th 2024, 2:33 am

    Forum logs me out around every hour Java110

    Thats the JavaScripts we have, they never made problem related to random log off.
    Nothing but new widgets was added in the forum when this issue started (only on my side).
    Now for few hours i didnt got kicked out, till now (its role play forum so i was writing a post for past around 2 hours and it kicked me out of my profile). Was thinking to wait till the morning to see if it logs me off but..it did it randomly now.

    The issue is kind of random event - when it will kick me or not, so turning off all added stuff, because only 1 person is suffering the issue (and if these things - JavaScripts and other modfications - was making problems, it would happen past 4-5 months too). Because of that I ask if the log in widget (code i posted) is the one causing trouble, somehow.

    Edit: The scripts are basically what say in title - more colors for the topics, word counter and script providing link to specific post in a topic.
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51554
    Reputation : 3523
    Language : English
    Location : United States

    Solved Re: Forum logs me out around every hour

    Post by SLGray April 5th 2024, 5:30 am

    So it is only happening to you?



    Forum logs me out around every hour Slgray10

    When your topic has been solved, ensure you mark the topic solved.
    Never post your email in public.
    Razor12345
    Razor12345
    Support Moderator
    Support Moderator


    Male Posts : 1581
    Reputation : 268
    Language : Ukr, Rus, Eng
    Location : Ukraine

    Solved Re: Forum logs me out around every hour

    Post by Razor12345 April 5th 2024, 8:11 am

    Good morning!

    I have installed your code on the test forum. As in your case, the system did not remember my authorization and I had to log in again.

    I checked the request to the server when we select the "Log in automatically" feature and it looks like this:

    Forum logs me out around every hour Scree804

    As you can see, the "autologin" parameter is also passed, but your code does not have this parameter.

    Code:
    jQuery.post('/login', 'login=1&username='+document.getElementById('switch_uname').value+'&password='+document.getElementById('switch_pass').value

    You only pass on the login and password. This code corresponds to a POST request for authorization without the "Log in automatically" function activated.

    Add
    Code:
    &autologin=on
    to your POST request:

    Code:
    jQuery.post('/login', 'login=1&username='+document.getElementById('switch_uname').value+'&autologin=on&password='+document.getElementById('switch_pass').value



    Forum logs me out around every hour Screen51
    ThePumpkin
    ThePumpkin
    New Member


    Female Posts : 15
    Reputation : 1
    Language : Bulgarian

    Solved Re: Forum logs me out around every hour

    Post by ThePumpkin April 5th 2024, 12:51 pm

    SLGray wrote:So it is only happening to you?

    Yes, it was happening only to me. I ask other members - noone seems to experience the issue.

    Razor12345 wrote:Good morning!

    Thank you so much for the help! I put that in the code, will keep eye on the forum and if random kicks happen again. If not i will mark the topis as Solved.
    ThePumpkin
    ThePumpkin
    New Member


    Female Posts : 15
    Reputation : 1
    Language : Bulgarian

    Solved Re: Forum logs me out around every hour

    Post by ThePumpkin April 5th 2024, 3:20 pm

    Little update - Forum kicked me out again, even after the change in the code (unless i didnt do it correctly)
    Ape
    Ape
    Administrator
    Administrator


    Male Posts : 19432
    Reputation : 2010
    Language : fluent in dork / mumbojumbo & English haha

    Solved Re: Forum logs me out around every hour

    Post by Ape April 6th 2024, 1:04 am

    Please try and clear your browser cache then log back in.



    Forum logs me out around every hour Left1212Forum logs me out around every hour Center11Forum logs me out around every hour Right112
    Forum logs me out around every hour Ape_b110
    Forum logs me out around every hour Ape1010
    ThePumpkin
    ThePumpkin
    New Member


    Female Posts : 15
    Reputation : 1
    Language : Bulgarian

    Solved Re: Forum logs me out around every hour

    Post by ThePumpkin April 6th 2024, 7:17 pm

    Today there wasnt any problems, so i will count this as Solved.
    Thank you Razor for the code fix! And thanks to the administrators of course!

    Ape and Razor12345 like this post

    Razor12345
    Razor12345
    Support Moderator
    Support Moderator


    Male Posts : 1581
    Reputation : 268
    Language : Ukr, Rus, Eng
    Location : Ukraine

    Solved Re: Forum logs me out around every hour

    Post by Razor12345 April 6th 2024, 7:38 pm

    That's great!
    I wanted to post at the end of the day that I can't display the problem on my test forum and on yours.

    Problem solved & topic archived.
    Please read our forum rules: ESF General Rules



    Forum logs me out around every hour Screen51

    Ape and ThePumpkin like this post


      Current date/time is November 12th 2024, 12:27 am