PVE/API2/Formatter/HTML.pm: avoid use of PVE::REST

Instead, pass the HTTP server as last argument to the page formater,
so that we can call $server->create_auth_cookie().

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
This commit is contained in:
Dietmar Maurer 2017-01-10 17:06:04 +01:00 committed by Fabian Grünbichler
parent ddaefd5c65
commit 617ca1c615
2 changed files with 4 additions and 2 deletions

View File

@ -3,7 +3,6 @@ package PVE::API2::Formatter::HTML;
use strict;
use warnings;
use PVE::REST;
use PVE::HTTPServer;
use HTTP::Status;
use JSON;
@ -267,7 +266,9 @@ PVE::API2->register_page_formatter(
my ($res, $data, $param, $path, $auth) = @_;
if (HTTP::Status::is_success($res->{status})) {
my $cookie = PVE::REST::create_auth_cookie($data->{ticket});
my $cookie = PVE::HTTPServer::create_auth_cookie(
$data->{ticket}, $auth->{cookie_name});
my $headers = HTTP::Headers->new(Location => $baseurl,
'Set-Cookie' => $cookie);
return HTTP::Response->new(301, "Moved", $headers);

View File

@ -1777,6 +1777,7 @@ sub auth_handler {
userid => $username,
age => $age,
isUpload => $isUpload,
cookie_name => $self->{cookie_name},
};
}