all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Gabriel Goller <g.goller@proxmox.com>
To: Thomas Lamprecht <t.lamprecht@proxmox.com>
Cc: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Subject: Re: [pve-devel] [PATCH manager 1/3] show optional consent-banner before login
Date: Wed, 4 Dec 2024 09:48:50 +0100	[thread overview]
Message-ID: <gpp5viaeo3qiuqh7jqvrufrxmqk73tol536qdw7vn7wdlakvd5@3p4qa7trdslb> (raw)
In-Reply-To: <21bdf589-787a-402f-9650-0e61e80fe581@proxmox.com>

On 03.12.2024 18:24, Thomas Lamprecht wrote:
>Am 03.12.24 um 16:29 schrieb Gabriel Goller:
>> Add ConsentBanner variable to html template and populate it from the
>> `datacenter.cfg` config file. Add Datacenter option to set the text and
>> trigger the popup on login.
>>
>> Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
>> ---
>>  PVE/Service/pveproxy.pm            |  4 +++-
>>  www/index.html.tpl                 |  3 ++-
>>  www/manager6/dc/OptionView.js      |  5 +++++
>>  www/manager6/window/LoginWindow.js | 13 ++++++++++++-
>>  4 files changed, 22 insertions(+), 3 deletions(-)
>>
>> diff --git a/PVE/Service/pveproxy.pm b/PVE/Service/pveproxy.pm
>> index ac1085457f2e..151ba34f8a52 100755
>> --- a/PVE/Service/pveproxy.pm
>> +++ b/PVE/Service/pveproxy.pm
>> @@ -217,9 +217,10 @@ sub get_index {
>>  	    $token = PVE::AccessControl::assemble_csrf_prevention_token($username);
>>  	}
>>      }
>> +    my $dc_conf = PVE::Cluster::cfs_read_file('datacenter.cfg');
>
>I forgot the details from top of my head, but does this fail if we're not quorate?
>If, then I'd wrap it in an eval to avoid breaking start up if not quorate.

Hmm I don't think so – no quorum should still allow read access.
Nevertheless it would still be better to wrap it in an eval!

>> +    my $consent_text = $dc_conf->{'consent-text'};
>>
>>      if (!$lang) {
>> -	my $dc_conf = PVE::Cluster::cfs_read_file('datacenter.cfg');
>>  	$lang = $dc_conf->{language} // 'en';
>>      }
>>
>> @@ -251,6 +252,7 @@ sub get_index {
>>  	version => "$version",
>>  	wtversion => $wtversion,
>>  	theme => $theme,
>> +	consenttext => $consent_text
>>      };
>>
>>      # by default, load the normal index
>> diff --git a/www/manager6/window/LoginWindow.js b/www/manager6/window/LoginWindow.js
>> index aaeca3550289..bcf9b7be364d 100644
>> --- a/www/manager6/window/LoginWindow.js
>> +++ b/www/manager6/window/LoginWindow.js
>> @@ -18,9 +18,20 @@ Ext.define('PVE.window.LoginWindow', {
>>      },
>>
>>      controller: {
>> -
>>  	xclass: 'Ext.app.ViewController',
>>
>> +	init: async function() {
>> +	    if (Proxmox.ConsentText) {
>> +		Ext.create("Proxmox.window.ConsentModal", {
>> +		    autoShow: true,
>> +		    consent: Proxmox.Markdown.parse(
>> +			Ext.htmlEncode(
>> +			    Proxmox.Utils.base64ToUtf8(
>> +				Proxmox.ConsentText))),
>
>IIRC I restructured the indentation here for the PBS side, maybe check that out, IMO
>it looks a bit hard to read as is.

Yep, definitely – fixed it.

>
>> +		});
>> +	    }
>> +	},
>> +
>>  	onLogon: async function() {
>>  	    var me = this;
>>
>


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

  reply	other threads:[~2024-12-04  8:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-03 15:29 [pve-devel] [PATCH cluster/docs/manager 0/3] fix #5463: add optional Consent Banner on login Gabriel Goller
2024-12-03 15:29 ` [pve-devel] [PATCH manager 1/3] show optional consent-banner before login Gabriel Goller
2024-12-03 17:24   ` Thomas Lamprecht
2024-12-04  8:48     ` Gabriel Goller [this message]
2024-12-03 15:29 ` [pve-devel] [PATCH cluster 2/3] add consent-text paramter to datacenter config file Gabriel Goller
2024-12-03 17:24   ` Thomas Lamprecht
2024-12-04  9:16     ` Gabriel Goller
2024-12-04 10:16       ` Thomas Lamprecht
2024-12-05 10:45         ` Gabriel Goller
2024-12-03 15:29 ` [pve-devel] [PATCH docs 3/3] add consent-banner description Gabriel Goller
2024-12-06 11:19 ` [pve-devel] [PATCH cluster/docs/manager 0/3] fix #5463: add optional Consent Banner on login Gabriel Goller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=gpp5viaeo3qiuqh7jqvrufrxmqk73tol536qdw7vn7wdlakvd5@3p4qa7trdslb \
    --to=g.goller@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    --cc=t.lamprecht@proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal