Jump to content

Need to notify users that they would be logged out


Recommended Posts

Hi,

 

Was hoping someone can help me here.

 

I know that the DataPage timeout  is a security feature of Caspio to prevent unauthorized access of other people when the user is AFK.

However, I would want my users to be notified if they will be logged out after a couple of minutes for them to save their work.

 

A support person suggested that I extend my login timeout in the Authentications. But I don't use one.

Finally,  he/she told me that it is possible to notify my users that they will be timed-out with the use of JavaScript.

Link to comment
Share on other sites

Hello @TroubleShooter,

 

You may try to add this snippet of JavaScript Code in the footer (source) of your DataPage. Just read through the inline comments (//).

 

Works for me in all DataPages where you can insert a Footer.

<script>
  
// Edit the values here to your liking
var message = 'You will be logged out after [x] minutes. Please save your work to prevent input loss.';
var hour = 0;
var min = 0;
var sec = 3;
// It is not necessary to edit things beyond this point
  
//Do not edit the Hour, Min, Sec here. They are used as a Default Value!
setTimeout(function(hour=0, min=0, sec=1) {
  
  //Do stuff here
  
  //Get Time Reference
  var timeRef = new Date().toLocaleTimeString('en-US');
  
  //Show the timeRef and the Message
  alert('[' + timeRef + '] ' + message); 
  
  //You can also do other stuff below such as (displaying a div, auto-press the save button, etc...)
}, (hour*1000*60*60 + min*1000*60 + sec*1000) );
  
</script>

 

Disclaimer: Use these JavaScript solutions at your own risk! They are provided to assist you in the customization of your programs and while we believe they work properly, by using them you accept all responsibility about them and confirm that they are not a feature of Caspio's platforms and as such are provided "as is" without any warranties, support or guarantees.

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.

Guest
Reply to this topic...

×   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.

Loading...
×
×
  • Create New...