mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-08-13 21:24:01 +00:00
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:
parent
ddaefd5c65
commit
617ca1c615
@ -3,7 +3,6 @@ package PVE::API2::Formatter::HTML;
|
|||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
|
||||||
use PVE::REST;
|
|
||||||
use PVE::HTTPServer;
|
use PVE::HTTPServer;
|
||||||
use HTTP::Status;
|
use HTTP::Status;
|
||||||
use JSON;
|
use JSON;
|
||||||
@ -267,7 +266,9 @@ PVE::API2->register_page_formatter(
|
|||||||
my ($res, $data, $param, $path, $auth) = @_;
|
my ($res, $data, $param, $path, $auth) = @_;
|
||||||
|
|
||||||
if (HTTP::Status::is_success($res->{status})) {
|
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,
|
my $headers = HTTP::Headers->new(Location => $baseurl,
|
||||||
'Set-Cookie' => $cookie);
|
'Set-Cookie' => $cookie);
|
||||||
return HTTP::Response->new(301, "Moved", $headers);
|
return HTTP::Response->new(301, "Moved", $headers);
|
||||||
|
@ -1777,6 +1777,7 @@ sub auth_handler {
|
|||||||
userid => $username,
|
userid => $username,
|
||||||
age => $age,
|
age => $age,
|
||||||
isUpload => $isUpload,
|
isUpload => $isUpload,
|
||||||
|
cookie_name => $self->{cookie_name},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user