Custom Software Services for Forward-Thinking Organizations

View Original

Last Login and Logout (Object Based)

Want to know the last time a user logged in to your Knack app?

This feature is usually implemented to keep track of the users who use the application, especially the period of time in which a session lasts.

Knack applications allow you to implement authentication forms simply and quickly, however when establishing a control or audit on the logins or log outs that are constantly running within the application, you must resort to the help of JavaScript for that end. Below we list a series of steps that will serve as a guide for the implementation of these logs:

1. Create a new object in the database: Although the object can have any number of fields, it is recommended that it have at least three fields: Email, Date / Time and Action (Multiple Choice = Login or Logout).

2. Add the following lines of code within the API & Code section:

See this content in the original post

And on this object you can use different native Knack components such as tables, reports or graphs.

We’re sure this will come in handy on all your projects. 

Did you like it?

Please let us know!