From 617ca1c615c99c6ca7733a239b954d062c57d8f0 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Tue, 10 Jan 2017 17:06:04 +0100 Subject: [PATCH] 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 --- PVE/API2/Formatter/HTML.pm | 5 +++-- PVE/HTTPServer.pm | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/PVE/API2/Formatter/HTML.pm b/PVE/API2/Formatter/HTML.pm index 31650880..69c0d979 100644 --- a/PVE/API2/Formatter/HTML.pm +++ b/PVE/API2/Formatter/HTML.pm @@ -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); diff --git a/PVE/HTTPServer.pm b/PVE/HTTPServer.pm index d2ae1fec..10263e9e 100755 --- a/PVE/HTTPServer.pm +++ b/PVE/HTTPServer.pm @@ -1777,6 +1777,7 @@ sub auth_handler { userid => $username, age => $age, isUpload => $isUpload, + cookie_name => $self->{cookie_name}, }; }