Get a longer timeout in the panel

Hello
As explained here, I set 2 variables in the panel to have a longer connection time in the panel:

c::set('panel.session.timeout', 3000);
c::set('panel.session.lifetime', 3000);

But still, the panel ask for credentials every 5 minutes or so…
What can I do to have a longer connection time in the panel?

Thank you

Kirby 2.5.6

You could try with a session fingerprint:

Session life time can only be set in the php.ini [http://php.net/manual/de/session.configuration.php]

If you can’t modify this setting, as everybody else on a cheap shared host, you can…

…get a ‘auto reload’ extension for your browser and open the dasboard in a new tab with the extension enabled.

… create a ‘custom field’ [https://getkirby.com/docs/developer-guide/panel/fields#adding-field-assets]
with a js snipped that ajax polls the session alive.

(‘fingerprints’ (‘csrf tokens’ aswell) are there but just want work out of the box with kirby, at least for me) :frowning:


svnt

Could you expand on that please? which code to use (and where)?

Ok. from here, I can add a custom fingerprint in config.php, like so:

s::$fingerprint = function() {
  return 'custom fingerprint';
};

Does it make sens to use the user_name value in this custom fingerprint?

s::$fingerprint = function() {
  return $user_name . '-fingerprint';
};

If so, how can I get the username inside config?

Thank you

You can get the current user with

$user = site()->user();
if($user) {
  $username = $user->username();
}

Honestly, I don’t know if it makes sense to use the username or not. As far as I know, the fingerprint should be something unique. The original fingerprint is created like this:

  public static function fingerprint() {

    // custom fingerprint callback
    if(is_callable(static::$fingerprint)) {
      return call(static::$fingerprint);
    } 

    if(!r::cli()) {
      return sha1(Visitor::ua() . (ip2long($_SERVER['REMOTE_ADDR']) & ip2long('255.255.0.0')));      
    } else {
      return '';
    }
  }

For testing if it makes any difference at all for your sessions , I’d use any simple string.

@texnixe Ok thanks, I try that.