klaucode
klaucode

Reputation: 330

Meteor framework - How to logout user after 5 minutes of innactivity

maybe I was not looking so deep, but I did not found the information in Meteor framework Docs, how and where I can set the time to logout user after for example 5 minutes of innactivity.

Q1: I’m using the “[email protected]” package. I found the possibility to set “loginExpirationInDays”: 0.05, but It not works correctly, because the login will expire sooner like expected. It seems to be, that loginExpiration time does not extend during working with the app.

Q2: Also, how can I calculate 5 minutes. Calculate proportion of the day? With this way, it not works.

1 hours is 1/24 = 0.041
30 min is 0.041/2 = 0.020
5 min = (0.041/60)*5 = 0,003417

I set 0.05 and it’s about 10minutes, If I will set lower value than 0.04, it not works.

I’m asking to understand and make me clear, how It works and how can I setup correctly the expiration and how can I solve the problem with noextend expiration time, when I’m using the app.

Thanks for each answer.

Upvotes: 0

Views: 443

Answers (3)

klaucode
klaucode

Reputation: 330

adel, thank you very much for your recommendation, I was created a thread also in Meteor forum: https://forums.meteor.com/t/how-to-logout-user-after-5-minutes-of-innactivity/54342/16

I was searching, for the solution, the "zuuk" solution is working but not solving the situation, if same user is logged more than one time with more tokens. Also don't logout user on close browser window/tab.

Therefore, I was created own new package acqsk:account-token-expiration, but I don't know, If I'm thinking with right way, because It's my first Atmosphere package: https://gitlab.com/acqsk/account-token-expiration

Thanks a lot for the answer.

Upvotes: 1

Harry Adel
Harry Adel

Reputation: 1436

Many of your concerns are discussed in great detail in this forum post.

tl;dr

You can use this package or that one.

Cheers!

Upvotes: 1

Minh Nguyen
Minh Nguyen

Reputation: 490

You can create a cron-job at the server side (e.g msavin:sjobs) which run every minute and clear the services.resume.loginTokens from the users you want to force to logout.

Upvotes: 2

Related Questions