Hi,
How can I change Login Time out,
It is too short and after timeout It is not shown on Flarum, It cause some problems.
thanks
Hi,
How can I change Login Time out,
It is too short and after timeout It is not shown on Flarum, It cause some problems.
thanks
There's no setting in the UI nor in config.php
but it can be changed via a call inside extend.php
.
Here's an example:
<?php
// File <flarum>/extend.php
use Flarum\Extend;
use Illuminate\Contracts\Config\Repository as ConfigRepository;
return [
// Register extenders here to customize your forum!
new Extend\Compat(function(ConfigRepository $config) {
$config->set('session.lifetime', 240); // In minutes. Default is 120
}),
];
For reference the default is defined here https://github.com/flarum/core/blob/v0.1.0-beta.10/src/Foundation/InstalledSite.php#L186
Hi,
The Session Timeout is too short, and after that the flarum shows user is login but after try to send post he will get problem.
How can I make session timeout longer for all users?
thanks
hamedkouhfallah I never had any issue staying logged in. Can you explain the set up of this user? OS, browser any browser addons that might impact his online experience?
hamedkouhfallah How can I make session timeout longer for all users?
See my suggestion above clarkwinkelmann that allows you to customize the session duration for users who don't use the "remember" feature.
luceos I never had any issue staying logged in
If you enable "remember me", then the session never really expires (it boots again from the remember cookie automatically). I rarely not use the remember feature, but I tested locally and the session does expire after 2 hours. If the Flarum tab is kept open during that time, strange things can happen if you try to start a new discussion or reply to the currently open discussion.
clarkwinkelmann
Thanks so much. I have implented it in my forum at https://www.kobocity.com
So i'm doing a bit of SSO with my implementation.. If i set the "flarum_remember" cookie is that the same thing as enabling "remember me"?
fusionfire yes
awesome.. thanks
This solution seems awesome but I have a problem with the latest version of Flarum, the Compat
class doesn't seems to be there anymore. Any suggestion ?
Fatal error: Uncaught Error: Class "Flarum\Extend\Compat" not found in ...
I tried a lot of things, even extending the SettingsRepositoryInterface
but nothing worked so far.
@milhouse1337 I was able to do this by manually updating the file:
/var/www/html/vendor/flarum/core/src/Foundation/InstalledSite.php
Line 186:
'lifetime' => 120,
Where 120 is the session lifetime in minutes.
SG57 keep in mind that file might get reverted anytime you update Flarum or an extension.
The original "trick" from 2019 is still valid, the only thing that changed is that it must be called through a service provider rather than a callback. I tested this code is valid but I haven't tested if it actually achieves what is intended in practice:
<?php
// File <flarum>/extend.php
use Flarum\Extend;
use Flarum\Foundation\AbstractServiceProvider;
use Illuminate\Contracts\Config\Repository as ConfigRepository;
class MyServiceProvider extends AbstractServiceProvider {
public function register () {
$this->container->make(ConfigRepository::class)->set('session.lifetime', 240); // In minutes. Default is 120
}
}
return [
// Register extenders here to customize your forum!
(new Extend\ServiceProvider)
->register(MyServiceProvider::class),
];
Just like in 2019, this doesn't change anything to the session access tokens though. Those still have their own logic to manage expiration.
clarkwinkelmann seems not working for 1.8