Expire inactive sessions, optionally allow to stay signed in #82

Merged
raucao merged 3 commits from feature/8-session_timeouts into master 2023-03-31 07:58:25 +00:00
3 changed files with 7 additions and 2 deletions
Showing only changes of commit e2618de7c6 - Show all commits

View File

@ -4,6 +4,10 @@ export default class extends Controller {
static targets = ["buttons", "countdown"]
connect() {
// Devise timeoutable ends up adding a second flash message without content
// TODO investigate bug
if (this.element.textContent.trim() == "true") return;
Outdated
Review

so the content has the value "true"?

so the content has the value "true"?

Yeah, for that unexpected additional flash message. I figured it's OK to hotfix like this, since no message should ever just say "true".

Yeah, for that unexpected additional flash message. I figured it's OK to hotfix like this, since no message should ever just say "true".
const timeoutSeconds = parseInt(this.data.get("timeout"));
setTimeout(() => {

View File

@ -38,7 +38,8 @@ class User < ApplicationRecord
devise :ldap_authenticatable,
:confirmable,
:recoverable,
:validatable
:validatable,
:timeoutable
def ldap_before_save
self.email = Devise::LDAP::Adapter.get_ldap_param(self.cn, "mail").first

View File

@ -210,7 +210,7 @@ Devise.setup do |config|
# ==> Configuration for :timeoutable
# The time you want to timeout the user session without activity. After this
# time the user will be asked for credentials again. Default is 30 minutes.
# config.timeout_in = 30.minutes
config.timeout_in = 24.hours
# ==> Configuration for :lockable
# Defines which strategy will be used to lock an account.