Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is last_sign_in_at used for in Devise?

A standard User column in Devise is last_sign_in_at, which holds the previous value of current_sign_in_at when current_sign_in_at is updated.

Does last_sign_in_at have any utility for Devise's core functionality or Module functionality, or is it just there as a general convenience?

like image 391
John Bachir Avatar asked Jul 06 '15 21:07

John Bachir


People also ask

How to display last sign in information using the registry?

How to Display Last Sign in Information Using the Registry 1 Use the Windows key + R keyboard shortcut to open the Run command. 2 Type regedit, and click OK to open the registry. See More....

How do I get the lastlogon value of an inactive user?

As we said earlier, if there are several domain controllers in your domain, then the lastlogon value on them may differ. If a user has been inactive for more than 14 days, the easiest way is to get the value of the lastLogonTimeStamp attribute from any domain controller.

How do I view devices where I'm currently signed in?

Review devices where you’re signed in Go to your Google Account. On the left navigation panel, select Security. On the Your devices panel, select Manage devices. You'll see devices where you’re currently signed in to your Google Account. For more details, select a device.

How do I find a user’s last logon time?

You can find out the time the user last logged into the domain from the command line using the net or dsquery tools. Open a command prompt (you don’t need domain administrator privileges to get AD user info), and run the command: You got the user’s last logon time: 08.08.2019 11:14:13.


2 Answers

last_sign_in_at is the date and time the user signed in before their current session, which is current_sign_in_at. It will be nil if they haven't signed in or this is their first session.

A better name might have been previous_sign_in_at because it is not the time they signed in last (the current one), it's the time before that.

It might be helpful to illustrate its use: After sign in, if updated_at on your Terms & Conditions page is newer than the user's last_sign_in_at then redirect them to a terms acceptance page.

As with most attributes in the Trackable module, it is not used internally to Devise although it is maintained by it.

like image 151
IAmNaN Avatar answered Sep 28 '22 00:09

IAmNaN


Looking through the source code, it seems to just be an attribute of Trackable -- meant purely as a general convenience.

https://github.com/plataformatec/devise/search?utf8=%E2%9C%93&q=last_sign_in_at

Additionally, the gemfile for Devise does not show anything that (I am guessing) would make use of that field.

So, just general convenience.

like image 40
Mike Manfrin Avatar answered Sep 27 '22 23:09

Mike Manfrin