[pbs-devel] [PATCH proxmox-backup 2/4] ui: show consent banner before login

Gabriel Goller g.goller at proxmox.com
Thu May 16 18:24:59 CEST 2024


Before showing the LoginView, make an api request to retrieve the
consent text. If it fails, don't show the banner, if it succeeds, show
the banner.

Signed-off-by: Gabriel Goller <g.goller at proxmox.com>
---
 www/LoginView.js | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/www/LoginView.js b/www/LoginView.js
index d4d8e73e..ec2995dd 100644
--- a/www/LoginView.js
+++ b/www/LoginView.js
@@ -20,6 +20,19 @@ Ext.define('PBS.LoginView', {
     controller: {
 	xclass: 'Ext.app.ViewController',
 
+	init: async function() {
+	    let resp = await Proxmox.Async.api2({
+		url: '/api2/extjs/access/consent',
+		method: 'GET',
+	    });
+	    if (resp.result.status === 200) {
+		Ext.create('Proxmox.window.ConsentModal', {
+		    autoShow: true,
+		    consent: resp.result.data,
+		});
+	    }
+	},
+
 	submitForm: async function() {
 	    var me = this;
 	    var loginForm = me.lookupReference('loginForm');
@@ -333,3 +346,4 @@ Ext.define('PBS.LoginView', {
 	},
     ],
 });
+
-- 
2.43.0





More information about the pbs-devel mailing list