rejetto forum

Bug: Logout function at server level [Fixed]

LeoNeeson · 28 · 26333

0 Members and 7 Guests are viewing this topic.

Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13521
    • View Profile
there is a flaw in the way you produce the problem: clicking is not enough, the logout is to be considered completed when you receive the answer from the server.

also, are you using the alpha 5 for your tests? because it contains more changes to the code i published  above, and the logout is also removing this session from all active connections, immediately.
See at https://github.com/rejetto/hfs2/commit/82de2130592f2c4ee5b832a17c5c6b7b059995ec


Offline SilentPliz

  • Operator
  • Tireless poster
  • *****
    • Posts: 1298
  • ....... chut ! shh!
    • View Profile

Thank you Leo for being one of the only people who thought that logging out was possible with HFS, and for working to lay the groundwork for a viable solution.

Thank you rejetto for your expert and complete implementation in the HFS code.

It's a good day today, I think! :) ;)


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13521
    • View Profile
i just updated the documentation for diff template, and you may be interested that it is possible to enter the path to an external file where you keep the diff template


Offline SilentPliz

  • Operator
  • Tireless poster
  • *****
    • Posts: 1298
  • ....... chut ! shh!
    • View Profile
i just updated the documentation for diff template, and you may be interested that it is possible to enter the path to an external file where you keep the diff template


Héhéhé !!!  :-*

« Last Edit: May 10, 2020, 02:30:48 PM by Mars »


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2063
    • View Profile

Quote from: silentpliz
Mars, arrête de pirater mes posts, sinon je me fâche !!!

 Finally Silentpliz found his electric razor  8)
before

and after

by its star rating we can see that its neurons are 100% charged again  ;D ;D




Offline SilentPliz

  • Operator
  • Tireless poster
  • *****
    • Posts: 1298
  • ....... chut ! shh!
    • View Profile
i just updated the documentation for diff template, and you may be interested that it is possible to enter the path to an external file where you keep the diff template
Tested today... I like that feature.  8) 
Thanks rejetto.


Offline LeoNeeson

  • Tireless poster
  • ****
    • Posts: 858
  • Status: On hiatus       (sporadically here)
    • View Profile
    • twitter.com/LeoNeeson
i just updated the documentation for diff template, and you may be interested that it is possible to enter the path to an external file where you keep the diff template
Tested today... I like that feature.  8) 
Thanks rejetto.
Yes, it comes very handy, thanks! :)

Text taken from the wiki: "Diff template: If you prefer you can keep the text in a file, and enter in this box just the path of the file." One question: I haven't thoroughly tested, but I guess it also support relative paths, and the file can have any name and extension besides "hfs.diff.tpl", right?. Can it be .\TempDiff.txt (and will it work)?...
HFS in Spanish (HFS en Español) / How to compile HFS (Tutorial)
» Currently taking a break, until HFS v2.4 get his stable version.


Offline LeoNeeson

  • Tireless poster
  • ****
    • Posts: 858
  • Status: On hiatus       (sporadically here)
    • View Profile
    • twitter.com/LeoNeeson
there is a flaw in the way you produce the problem: clicking is not enough, the logout is to be considered completed when you receive the answer from the server.
"clicking is not enough" (epic title for the next 007 movie!) ;D

Talking seriously, I do understand what you say, but even if you 'wait' to receive an answer from the server, this small issue continues. For example, I did this change on the template (marked in red color, and the result is the same):

Quote
function executeLogout() {
    var LogoutRealm = '__USER'+'='+'&'+'__AJAX'+'='+1;
    var xhr = new XMLHttpRequest();
    xhr.open('POST', '/');
    xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
        xhr.onreadystatechange = function() {
            if (xhr.readyState === 4) {
                if (xhr.status === 200) {
                    if (xhr.responseText === "ok") {
                        window.location.replace('/');
                    }
                }
            }
        };
    xhr.send(LogoutRealm);
};

also, are you using the alpha 5 for your tests? because it contains more changes to the code i published  above, and the logout is also removing this session from all active connections, immediately.
See at https://github.com/rejetto/hfs2/commit/82de2130592f2c4ee5b832a17c5c6b7b059995ec
Yes, I've seen the code changes (your changes are very good and extensive), but I guess there must be something else missing (some little detail). On my proposed fix, that issue doesn't happen (but I think it's a little bit ugly and aggressive to 'kick all the idle connections' like I did on my fix, and I don't know if that 'kick' could affect other users in a bad way). If this issue can not be solved, I was thinking of proposing to add a macro command to 'kick all the idle connections', and send this command using the template (for those who want this to be perfect).

also, are you using the alpha 5 for your tests? because it contains more changes to the code i published  above, and the logout is also removing this session from all active connections, immediately.
Yes, I was using v2.4 Alpha 5 yesterday, and today also tried v2.4 Alpha 7 (the MD5's issue was fixed on alpha 7, but this "small issue" is still present).

The 'key' to reproduce the problem is opening several tabs in your browser.

1) Install the old template and the form-based login (as usual).
2) Create one user and give that user access to a few folders (with files).
    (For example: Folder1, Folder2, Folder3, Folder4 and Folder5).
3) Login with that user, and open Folders 1 to 5, each one, on one tab.
4) Go to the tab of Folder1 (or any tab), and click on the Logout button.
5) Now go to the tab of Folder2 and click on one or more of the files there.
6) If it ask for password, click cancel and go to Folder3, Folder4 and Folder5 and try to access some of the files (during 15 to 30 seconds, you could access as many files as you want, some will fail, but some will go trough, depending on the timeout of that tab).

So, summarizing, you can continue (for at least 15 to 30 seconds), acceding to password protected files (until the last authenticated connection times out on the server). Sometimes it will ask for a password, but generally, you have 30 seconds to access some files. If you can't reproduce this, I can do a video to show this.

Cheers,
Leo.-
HFS in Spanish (HFS en Español) / How to compile HFS (Tutorial)
» Currently taking a break, until HFS v2.4 get his stable version.


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13521
    • View Profile
Text taken from the wiki: "Diff template: If you prefer you can keep the text in a file, and enter in this box just the path of the file." One question: I haven't thoroughly tested, but I guess it also support relative paths, and the file can have any name and extension besides "hfs.diff.tpl", right?. Can it be .\TempDiff.txt (and will it work)?...

extension doesn't matter. Relative paths probably work, and are probably based on the exe path. Should test tho.


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13521
    • View Profile
Talking seriously, I do understand what you say, but even if you 'wait' to receive an answer from the server, this small issue continues. For example, I did this change on the template (marked in red color, and the result is the same):

this change you are showing here is not relevant to what i said, because it's not stopping the user from going and click other tabs before the reply arrives.
Anyway, the rest you said made it clearer to me that there is probably some problem other than "speed".
For next release I'm making a deep rewriting of the access system. I didn't try to reproduce the problem with the previous version but only with the new one, with 5 tabs, and eveything went fine. I hope that's fixed, you'll tell me.


Offline LeoNeeson

  • Tireless poster
  • ****
    • Posts: 858
  • Status: On hiatus       (sporadically here)
    • View Profile
    • twitter.com/LeoNeeson
I hope that's fixed, you'll tell me.
I've tested the new build [v2.4 Alpha 8] and I can confirm the logout is now 100% -totally and absolutely- perfect (the small issue was finally solved!). Congratulations!
HFS in Spanish (HFS en Español) / How to compile HFS (Tutorial)
» Currently taking a break, until HFS v2.4 get his stable version.


Offline elllectrum

  • Occasional poster
  • *
    • Posts: 1
    • View Profile
Leo, hello!
There is a problem: If you log in locally, then the authorization form works fine, but if you access HFS from outside, via the Internet, the authorization form does not work, it does not respond to login / password. Please help me figure it out.


Offline LeoNeeson

  • Tireless poster
  • ****
    • Posts: 858
  • Status: On hiatus       (sporadically here)
    • View Profile
    • twitter.com/LeoNeeson
Leo, hello!
There is a problem: If you log in locally, then the authorization form works fine, but if you access HFS from outside, via the Internet, the authorization form does not work, it does not respond to login / password. Please help me figure it out.
Hi! and welcome... :)

Sorry for my late reply (I've received your private message)

Your message doesn't say what version are you using, but please make sure you use latest v2.4 (or the new HFS3). The default template of HFS v2.x depends on jQuery to work, and some older templates (based on versions older than HFS v2.3f), were using an external CDN for jQuery. Since you say it works fine locally, perhaps 'something' is blocking or interfering with the access to jQuery (and therefore, affecting the login). Sadly, I could not give you more ideas than that. I currently don't have time to deal with complex issues, but if you add much more details, perhaps we could possibly have more idea of what is causing your issue (but I cannot promise to solve it).

For as much as I would like to help people, please consider this thread closed, since it was a technical discussion to implement the logout system, which was already added on HFS 2.4. Your issue is about the login, not logout anyway (in that case, is much better open a new thread, along with more details).

Cheers,
Leo.-
HFS in Spanish (HFS en Español) / How to compile HFS (Tutorial)
» Currently taking a break, until HFS v2.4 get his stable version.