rejetto forum

Software => HFS ~ HTTP File Server => Topic started by: fire2050 on February 08, 2012, 05:28:23 AM

Title: Events and Unique Usernames
Post by: fire2050 on February 08, 2012, 05:28:23 AM
Hello all,

So I have been looking into a method to notify me if a user logs into my server.

The best method to do this in my opinion would be to utilize the events triggers and output the username to a text file.

Then run a batch file that would email the info to myself.

Is this doable via the events log? If so I cant seem to find the triggers for the events window and then how could I output the unique username of who logged in to a text file? Perhaps a list to a text file?

Ex: larry,moe,curly,shemp,admin

Thanks for the help.
Title: Re: Events and Unique Usernames
Post by: rejetto on February 09, 2012, 12:22:03 PM
problem is: currently there's no real login in HFS.
It relies on http authentication, that's different. There's no session. (next HFS version won't work this way)
But you can workaround this by using cookies.
You also have commands to set and get cookies in HFS.
Title: Re: Events and Unique Usernames
Post by: raybob on February 10, 2012, 07:42:54 PM
You could capture {.header|authorization.} under [request] with something like
 
Code: [Select]
{.if|{.header|authorization.}|{:{.save|user-{.time.}.txt|{.header|authorization.}.}:}.}
but the result would be encoded in base64 (https://www.google.com/search?q=base+64+decoder) and would capture both passwords and usernames.
Title: Re: Events and Unique Usernames
Post by: fire2050 on February 15, 2012, 12:52:21 AM
Thanks for both of your input.

I guess I am not familiar enough with coding to know how to make what you gave as an example work. I tried what you have there and it seemed to do nothing.

Just a little more pushing in the right direction and it sounds like I should have something I can work with.
Title: Re: Events and Unique Usernames
Post by: rejetto on February 17, 2012, 03:21:30 PM
currently there's login, everytime the password is sent.
so, it is "password" provided or not.
you can do something like

if (password provided) and (there's no cookie) {
  set the cookie
  notify about the user
}


another problem is: i think HFS currently will not let you know if the password is right or wrong. So if a user tries to enter with the wrong password, this method will let you think he logged in, while he didn't. I guess this is just too wrong.

HFS 3 will not have this problem.
Title: Re: Events and Unique Usernames
Post by: fire2050 on February 20, 2012, 04:50:10 AM
Ok I suppose I will just wait until HFS 3 comes out.

btw I love the simplicity and flexibility of your program.

Keep up the great work.
Title: Re: Events and Unique Usernames
Post by: rejetto on February 20, 2012, 10:35:01 AM
thanks, but don't hold your breath for version 3, it will probably arrive in a year or so.