Jump to content

Module: Process Login History


teppo
 Share

Recommended Posts

Whenever I edit a module in the modules directory and submit the changes it instantly grabs the new version number and code from Github. Of course you could even change the version number when editing, but it shouldn't be necessary

Link to comment
Share on other sites

  • 6 months later...
  • 4 months later...

Hi Teppo - thanks for the great module

In my setup for a site with membership - I set member user 'names' (not admins) with a numerical value to match their unique membership id for the organisation (not set within pw). 

Your module however logs users with a numerical 'name' as nonexistant, stores their $user->id as 0 and logs the login as a failure when it has been successful

Kind regards

Nik

Link to comment
Share on other sites

  • 1 month later...

I have this installed on a project and was working fine until I wanted to open it up today and bamm

TemplateFile: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER BY username DESC' at line 4 SELECT DISTINCT username FROM ORDER BY username DESC<pre>#0 [internal function]: Database->query('SELECT DISTINCT...') #1 /home/www-data/*/wire/core/DatabaseMysqli.php(35): call_user_func_array(Array, Array) #2 /home/www-data/*/site/modules/ProcessLoginHistory/ProcessLoginHistory.module(492): DatabaseMysqli->__call('query', Array) #3 /home/www-data/*/site/modules/ProcessLoginHistory/ProcessLoginHistory.module(492): DatabaseMysqli->query('SELECT DISTINCT...') #4 /home/www-data/*/site/modules/ProcessLoginHistory/ProcessLoginHistory.module(159): ProcessLoginHistory->renderFilters() #5 [internal function]: ProcessLoginHistory->___execute() #6 /home/www-data/*/wire/core/Wire.php(365): call_user_func_array(Array, Array) #7 /home/www-data/*/wire/core/Wire.php(320): Wire->runHooks('execute', Array) #8 /home/www-data/*/wire/core/ProcessController.php(213): Wire->__call('execute', Array) #9 /home/www-data/*/wire/core/ProcessController.php(213): ProcessLoginHistory->execute() #10 [internal function]: ProcessController->___execute() #11 ...

This is on latest PW dev. There were no relevant changes as far as I can tell.

Link to comment
Share on other sites

After looking a little closer, the table name isn't set, so finally it looks like the module ProcessLoginHistoryHooks isn't installed/loaded although it's there, just not listed in the modules. Module refresh does not help. Strange, according to the entries in the table the last login was friday evening, when it suddenly stopped recording. I have no idea what's going on but heard others had problems with modules suddenly disapearing. :/

Link to comment
Share on other sites

I have no idea why but when I comments out

'requires' => 'ProcessLoginHistory'

in ProcessLoginHistoryHooks.module it suddenly works again. And the module is again listed in admin too. I add this line and it disappears :)

ProcessLoginHistory.module isn't autoload module, that's the only clue I can guess.

Link to comment
Share on other sites

@Soma: relatively easy "solution" would be forcibly loading the ProcessLoginHistoryHooks.module file in ProcessLoginHistory::construct, but I'd like to avoid that if possible -- feels like a hack, might not completely fix the issue, and I'd really like to know first why this is happening out of the blue. The symptoms made me wonder if it's just a question of load order (that's something I've had various issues with before), but on the other hand the hooks module not showing up in installed modules makes me wonder if it's something entirely different :)

I can't seem to reproduce anything you've mentioned here at the moment. I've heard of somewhat similar issues before (in fact just a few moments ago I replied to a report where similar issue was affecting my VersionControl module), so I believe that this is a real issue. Is there anything you can think of that could've caused this -- updates, environment changes, corrupted files (cache/other), automatic processes running wild, or something? Have you updated/installed other modules, perhaps using built-in tools or modules manager, or something?

Would love to get my hands on an installation where this "disappearing modules" error occurs, but it seems kind of random and usually only happens on real-world sites. So damn frustrating :)

For the time being I'm going to take a closer look at changes to Modules.php. Looks like there have been quite a few of those recently, so perhaps something is actually broken/changed..

Link to comment
Share on other sites

Last that I did at that time/day was install procache. Then I had troubles with Revive (AD tool) that we include in front-end banner scripts. It is setting UTC timezone due to a bug. So after that I did add script to set correct timezone after those scripts and it was working again. It's nothing that would be in backend only front-end scripts. But due to that procache wasn't porperly working and deleting cache all the time. At that time I think the issue popped up.

There were no major changes other than procache. The update to latest PW was before that day and I did a update today. 

So far I can't reproduce it anymore. I change it back to as it was and it's working. When the error appeared I did refresh, delete all caches (db, files) but no luck until I changed the module and removed the "requires". 

Never experienced something like it.  APC php cache is active on that server.

Link to comment
Share on other sites

  • 2 weeks later...

Looks like it happened again. I installed a module via url. After that the Login History module had the same issue as I mentioned.

Edit: I have a local install (not same as the project) where I try to reproduce it but can't. Driving me crazy.

Link to comment
Share on other sites

  • 1 year later...

What Adrian said :)

If the question is whether I plan to release a separate 3.x version with namespace declarations in place, I honestly haven't even thought about that yet. On the other hand I do intend to support both 2.x and 3.x for the time being, so if this module isn't playing nicely together with the compilation feature of 3.x, please let me know.

  • Like 1
Link to comment
Share on other sites

Acutally I've been meaning to post, I'm having an issue just so happened I saw this thread come to life :D
 
First, thankyou for such a great module Teppo!
 
Is anyone able to test if they have any issues viewing their user profile when logged in as themsleves, when this module is enabled?  Just want to know if its just my configuration, or something else I have conflicting with this module.
 
I can view other user profiles fine, it's only when looking at the user which is logged in.
 
Using PW 3.0.20
ProcessLoginHistory 1.2.8
 
Error code is attached.
 
Thanks!
 

post-3748-0-20373900-1465428811_thumb.pn

Link to comment
Share on other sites

Thanks for reporting this, @grimezy! One issue I can see right away is that date_diff() can indeed return "false" on failure, and this case is not properly handled by the code visible above. Real question, though, would be why this happens.

Mostly guessing from the error you're seeing and the code visible above, most probable cause would be some kind of an issue with $login_date, which in turn could either mean that login_timestamp row in database is empty or contains something unexpected.. or it could mean that $date_format is somehow broken.

I was unable to reproduce this issue based on a quick test and I'll have to step away for a few hours now, but I'll try to debug this further (hopefully) later today :)

  • Like 1
Link to comment
Share on other sites

Hey Teppo,

Thanks for the fast response.  Your correct in that it was the $login_date which was causing the issue.

In the LoginHistory settings for 'Date Format', I had inserted a character (-) separating the time and date.  Just removed this and works fine again.

Thanks for your help!

  • Like 2
Link to comment
Share on other sites

  • 2 weeks later...
  • 2 years later...

Hi @teppo,

I recently thought about writing a small module to record the last login of a user, in order to show the user when he logged in the last time before the current login.
The data, which is necessary for this feature, is already built in your module.
What do you think, would that be a good addition to your module? So maybe a public function which just returns the second recent login. 

Just thought it may be useful for someone else, too.

Link to comment
Share on other sites

  • 1 year later...

Hello @teppo,

when using the module with @ryan's TOTP two-factor authentication, the user is logged as "Successful attempt: NO", and the user id instead of  the name. is displayed in the "WHO" column.

Probably because the login process has an extra TOTP code screen.

Link to comment
Share on other sites

  • 5 months later...
On 5/21/2019 at 7:23 PM, androbey said:

Hi @teppo,

I recently thought about writing a small module to record the last login of a user, in order to show the user when he logged in the last time before the current login.
The data, which is necessary for this feature, is already built in your module.
What do you think, would that be a good addition to your module? So maybe a public function which just returns the second recent login. 

Just thought it may be useful for someone else, too.

Sorry for the late response. This makes sense to me, but I'll have to get back to it later. In the meantime I've created an "enhancement" issue for it here: https://github.com/teppokoivula/ProcessLoginHistory/issues/6.

On 7/10/2020 at 7:29 PM, JFn said:

Hello @teppo,

when using the module with @ryan's TOTP two-factor authentication, the user is logged as "Successful attempt: NO", and the user id instead of  the name. is displayed in the "WHO" column.

Probably because the login process has an extra TOTP code screen.

Thanks for letting me know. This was a bug, now fixed in the latest release of the login history module (1.5.1).

Link to comment
Share on other sites

  • 1 year later...

Hello

I tried to change some of the user setings when suddenly ?. I'm getting weird error when clicking on some of the users. Some of them are working fine but on some I get this error.
I have Login Scheduler installed!

Users-error.thumb.jpg.3278f161474687c1737bd0464842aedb.jpg

Not sure how to fix this .. My PHP is v7.4 ...

Any help appreciated.

R

Link to comment
Share on other sites

  • Roych changed the title to Getting ProcessLoginHistoryHooks.module:500 error!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...