} or Abort('Database error', 501, $@);
my $user = eval {
+ my $rootpath = ($ENV{REQUEST_URI} // '/writer') =~ s{(?<!^)/.+}{}r;
if (defined $post{username}) {
$cookie{login} = EncodeURI(join ':', @post{qw( username pass )});
}
if (AddCookie(CGI::Cookie->new(
-name => 'login',
-value => '',
- -path => '/writer',
+ -path => $rootpath,
-expires => 'now',
)->as_string)) {
delete $cookie{login};
my $httpcookie = CGI::Cookie->new(
-name => 'login',
-value => join(':', @{$found}{qw( username pass )}),
- -path => '/writer',
+ -path => $rootpath,
) or die "prepared object is empty\n";
AddCookie($httpcookie->as_string);
} or Abort(["Unable to create login cookie", $@], 403);