summaryrefslogtreecommitdiff
path: root/lib/JWebmail/Plugin
diff options
context:
space:
mode:
Diffstat (limited to 'lib/JWebmail/Plugin')
-rw-r--r--lib/JWebmail/Plugin/ServerSideSessionData.pm8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/JWebmail/Plugin/ServerSideSessionData.pm b/lib/JWebmail/Plugin/ServerSideSessionData.pm
index c28f6d1..16b68b1 100644
--- a/lib/JWebmail/Plugin/ServerSideSessionData.pm
+++ b/lib/JWebmail/Plugin/ServerSideSessionData.pm
@@ -6,7 +6,7 @@ use Fcntl qw(:DEFAULT :seek);
use Time::HiRes 'sleep';
use Mojo::JSON qw(decode_json encode_json);
-use Mojo::File;
+use Mojo::File 'tempdir';
use constant {
@@ -138,7 +138,11 @@ sub register {
my ($self, $app, $conf) = @_;
$conf //= {};
- $self->session_directory(Mojo::File->new($conf->{directory} || "/tmp/" . $app->moniker));
+ $self->session_directory(
+ $conf->{directory}
+ ? Mojo::File->new($conf->{directory})
+ : tempdir($app->moniker.'_XXXXXXXXXX', TMPDIR => 1)
+ );
$self->expiration($conf->{expiration} || $app->sessions->default_expiration);
$self->cleanup_interval($conf->{cleanup_interval} || $self->expiration);