From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 6E3B5604B6 for ; Tue, 17 Nov 2020 09:05:46 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 66C12CFEA for ; Tue, 17 Nov 2020 09:05:16 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [212.186.127.180]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 14C40CFCF for ; Tue, 17 Nov 2020 09:05:15 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id CC7A543150 for ; Tue, 17 Nov 2020 09:05:14 +0100 (CET) From: Dominik Csapak To: pmg-devel@lists.proxmox.com Date: Tue, 17 Nov 2020 09:05:13 +0100 Message-Id: <20201117080513.15046-5-d.csapak@proxmox.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201117080513.15046-1-d.csapak@proxmox.com> References: <20201117080513.15046-1-d.csapak@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.354 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [html.tt] Subject: [pmg-devel] [PATCH pmg-gui 1/1] add 'Request Quarantine Link' Button to LoginView X-BeenThere: pmg-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Mail Gateway development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Nov 2020 08:05:46 -0000 if the template has 'quarantinelink' enabled, we show a button 'Request Quarantine Link' on the quarantine login ui there a user can enter their e-mail and request a link to the quarantine Signed-off-by: Dominik Csapak --- js/LoginView.js | 33 +++++++++++++++++++++++++++++++++ pmg-index.html.tt | 3 ++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/js/LoginView.js b/js/LoginView.js index 8e610aa..5546517 100644 --- a/js/LoginView.js +++ b/js/LoginView.js @@ -10,6 +10,10 @@ Ext.define('PMG.LoginView', { let realmfield = me.lookup('realmfield'); + let enableQuarantineLink = view.targetview === 'quarantineview' && !!Proxmox.QuarantineLink; + + me.lookup('quarantineButton').setVisible(enableQuarantineLink); + if (view.targetview !== 'quarantineview') { return; } @@ -65,6 +69,28 @@ Ext.define('PMG.LoginView', { } }, + openQuarantineLinkWindow: function() { + let me = this; + me.lookup('loginwindow').setVisible(false); + Ext.create('Proxmox.window.Edit', { + title: gettext('Request Quarantine Link'), + url: '/quarantine/sendlink', + method: 'POST', + items: [ + { + xtype: 'proxmoxtextfield', + name: 'mail', + fieldLabel: gettext('Your E-Mail'), + }, + ], + listeners: { + destroy: function() { + me.lookup('loginwindow').show(true); + }, + }, + }).show(); + }, + control: { 'field[name=lang]': { change: function(f, value) { @@ -76,6 +102,9 @@ Ext.define('PMG.LoginView', { window.location.reload(); }, }, + 'button[reference=quarantineButton]': { + click: 'openQuarantineLinkWindow', + }, 'button[reference=loginButton]': { click: 'submitForm', }, @@ -172,6 +201,10 @@ Ext.define('PMG.LoginView', { }, ], buttons: [ + { + text: gettext('Request Quarantine Link'), + reference: 'quarantineButton', + }, { text: gettext('Login'), reference: 'loginButton', diff --git a/pmg-index.html.tt b/pmg-index.html.tt index 4faf0cf..4a29ba2 100644 --- a/pmg-index.html.tt +++ b/pmg-index.html.tt @@ -30,7 +30,8 @@ Setup: { auth_cookie_name: 'PMGAuthCookie' }, NodeName: '[% nodename %]', UserName: '[% username %]', - CSRFPreventionToken: '[% token %]' + CSRFPreventionToken: '[% token %]', + QuarantineLink: [% IF quarantinelink %] true [% ELSE %] false [% END %], }; -- 2.20.1