Detect when a devise session expires

后端 未结 2 386
北恋
北恋 2021-01-13 14:52

I\'d like to record when a user\'s session has timed out, using devise and :timeoutable.

At the moment, :timeoutable is working as expected

2条回答
  •  隐瞒了意图╮
    2021-01-13 15:22

    I think what you need to do is logging the time when the user clicks "Log out" explicitly. Because :timeoutable has a default time period after which user session will automatically expire.

    You can do logging "log out" activity by creating a Sessions_Controller which inherits from Devise::SessionsController. After logging current time, don't forget to do super.

提交回复
热议问题