Jump to content
  • 0



16 answers to this question

Recommended Posts

  • 0

To track the number of logins, you can create a submission page which is based on a table with the following fields: User_ID (text 255), DateSubmitted (Timestamp) . This DataPage should be Authenticated and the destination after submission should be the page you want to redirect users to when they login. Make User_ID a hidden field which is receiving value from authentication and then add HTML block at the end of element list and use this code to auto submit the page

This page will be used as login page and since it is being auto-submitted user info will first get saved to the table and then user will be redirected to destination.

Link to comment
Share on other sites

  • 0

Hi MayMusic,


I am trying to create a presence (user logged in) and timestamp of login for users. I am curious if this would be the same thing for me, but I cannot make this work. I created a submission page, created a table for the login and timestamp, user ID etc, but I must be doing something wrong. Any help would be appreciated...



Link to comment
Share on other sites

  • 0

Hi @techguy


I think it would be better to create a separate post for that question, so other user can also see your case and help you further.

With regards to your work flow, If you are looking for a timestamp to stamp the date and time when the user logs in your application, you can add a timestamp field in the configuration of your authentication. Maybe I can help you further if you can elaborate.



~ H

Link to comment
Share on other sites

  • 0


I have followed MayMusics advise and it works for me.

You may also use this with the Caspio's redirect base on user's level so can still track records even if you have multiple user level. You will need two data pages though.

I will simplify my workflow with this pattern

Login--> auto submision form for tracking log in records --> html datapages with JS for redirecting.

You can refer to this page if you want information about the multiple user level redirection: https://howto.caspio.com/tech-tips-and-articles/common-customizations/create-user-specific-redirect-after-login/

hope it helps anyone. 


Link to comment
Share on other sites

  • 0

Hey MayMusic, Hey NiceDuck

Your workflows are terrific. Thank you so much.
I modified your  workflow a little  to also record the log out date/time of the user . 

first, I added another text field  255 in my table. This will be our indicator if the user logged in or logged out on that certain time.

Then, I made another auto submission form similar to what MayMusic describes, the only difference is the new text field 255 which has an auto value of  'Log out'. Note that you have to add this field to the auto submission form you are using for your log-in and make its auto value a 'Log in'.

Then we make it redirect to the logout link.

Its going to make a lot of redirection though, specially if your authentication has an auto redirection somewhere too.

Thank you again.


Link to comment
Share on other sites

  • 0

Hey Shiro

I do have a similar workflow too for my log out.  However, I noticed that on your workflow, the log in values will be recorded separately with its log out records.  

Unless you have a reason for separating those values, I suggest that you try this workflow. 

Add a text 255 field on your User accounts table (the table which has the log in credentials of the users). I named mine as 'track_id' Note that If you are using a view for your authentication, please include this newly added field to your view.

The table where you record the log values should have the following fields:

     * log_id  -- any ID field   *for me, I used an GUID

     *Log in time -- Date/time field

     *Log out time -- Date/time field

     * user_id  -- text field.

Make report details page. Use your table for log records as a data source.   Data selection,  select "Filter data based on your pre-defined criteria" ---> "Allow parameters in search criteria" ---> Bridge parameters only.

Restrict the record based on user identity (Record Level Security)

 set the identity field in Authentication to the 'track_id' then set the matching field in current data source  as 'log_id'

dont select any fields for your Select Filtering Fields.  The record level security will do the filtering itself.

Select only the log out time field on fields for results. set it to hidden with timestamp value 

Dont forget to apply the JS for auto submit.

For     Destination and Messaging ,  select "go to a new page" then write your log-out URL.


Also, Note that in your auto submission form for your log-in, you have to stamp the users ID into the user_id field.

Then you'll need a trigger for your table for log records that activates upon insert. The goal of this trigger is to  copy the 'log_id' to the 'track_id' in your user account table. 

to summarize this story, what i did was

Log-in --> autosubmision form which records the login time and user id on the table for log records -->  HTMLpages with JS for redirecting

                                                                                                                                                                                                                           '-->Also, the  trigger will  then look at whose user has log in

                                                                                                                                                                                                                                            and update his copies the log id to this users track_id field 


Log-out --> details page which locate the right Log records using the value on the users track_id field via record level security filtering -->  timestamp the logout time to logout field --- redirect to log-out link.


I hope you try it Shiro.




Link to comment
Share on other sites

  • 0

Hi NiceDuck, I am building this out this week but have a question....


How do you handle if the user closes the browser instead of "logging" out of the app? Just curious if there is an auto log out function or some other way to handle this or does it matter?


Thank you

Link to comment
Share on other sites

  • 0

NiceDuck's suggestion works for my app only to a certain extent. Sadly, the log-out time is stored against the previous Session_ID of the user. It appears that the authentication routine stores the status of the fields in the authentication table at the moment of authentication, and not refreshes them after the Session_ID gets updated (in my case via a trigger). 

I track the user's login via a hidden Auto Log In page in the T_User_Log table. I have a trigger on insert in that T_User_Log table that copies the random Session_ID into its equivalent in the T_User table.  Next, I have a Log Out page that should put a timestamp in the Log table for this Session_ID.

The solution is to create a View (in my case Q_Current_User_Sessions) based on the T_User and T_User_Log tables. Inner Join the tables on both their respective User_ID and Session_ID fields and set the latter to be editable.  Fields to include are Log_User_ID, Log_Session_ID and Log_Out_Time (without criteria).

Design the DP User_Log_Auto as a Details Report, select Q_Current_User_Sessions as the source, and require authentication. Restrict record access based on User_ID identity matching Log_User_ID. Set no filters, and select Log_Out_Time as the only field for the Details Page. Hide Log_Out_Time to receive on load the system parameter Timestamp. Hide the form with a style in the Header and add an HTML Block at the bottom of the page elements with an auto-submit script.

After record update, close the window, and - voila - we have working (and hidden) User_LogOut_Auto page.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...