Last login doesn't display

deekayen - June 15, 2009 - 21:43
Project:Login Security
Version:6.x-1.x-dev
Component:User interface
Category:bug report
Priority:normal
Assigned:ilo
Status:closed
Description

The option to display the user's last login/access doesn't seem to be setting the message through drupal_set_message for a successful login.

#1

ilo - June 16, 2009 - 22:52
Assigned to:Anonymous» ilo
Status:active» needs review

mm...

Currently the notification of the last access and login is done in the "login" op of the hook_user, what IMHO is not correct. The last access could be done in the the 'login' op, as account is loaded with this value untouched in the $account param. The problem is for the last login timestamp. The account is loaded, but not in the $user variable, therefore the values are not populated to the 'login' op.

This patch will update the "last login" variable everytime a user is loaded. I don't like it but it works. For the login workflow, only one account is loaded, and it's the logged in account. The last access timestamp is fixed also.

AttachmentSize
login_security_492600_1.patch 1.39 KB

#2

deekayen - June 16, 2009 - 23:44
Status:needs review» needs work

I actually made that same patch on my own. It fails the additional tests I just committed. The problem shows on a user's first login. hook_user is firing the login op first and those elements of the object are set, but the access and login are already set by then. That means the last login time is the same instance of the current login.

#3

deekayen - June 17, 2009 - 02:36

Perhaps the new user_load I added to the validate could be used to temporarily store the access and login time? Then unset it from the session after the drupal_set_message is executed.

#4

ilo - June 17, 2009 - 14:56

I'll commit this and the other minor issues for now, and we can review the login process more deeply later. Do you think we can consider the "first login issue" as normal situation for now?.

Do I patch and commit?

#5

deekayen - June 17, 2009 - 15:00

I don't see it as a minor issue. It breaks the tests because there is a message on the first login and shouldn't be one at all. The subsequent logins also show the current login's instance timestamp. I just meant I discovered the problem because the first login shouldn't have had a message in the first place. The previous login tests I committed don't assertPattern for a reasonable date string which is why the rest of the tests don't fail.

#6

deekayen - June 17, 2009 - 17:54

#7

System Message - July 1, 2009 - 18:00
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.