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 EFE9B606BB for ; Tue, 17 Nov 2020 15:58:16 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id E6DC012AC3 for ; Tue, 17 Nov 2020 15:57:46 +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 0D47412AA3 for ; Tue, 17 Nov 2020 15:57:45 +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 CABD3430FD for ; Tue, 17 Nov 2020 15:57:44 +0100 (CET) From: Dominik Csapak To: pmg-devel@lists.proxmox.com Date: Tue, 17 Nov 2020 15:57:43 +0100 Message-Id: <20201117145743.10561-5-d.csapak@proxmox.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201117145743.10561-1-d.csapak@proxmox.com> References: <20201117145743.10561-1-d.csapak@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.347 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 v2 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 14:58:17 -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 | 31 +++++++++++++++++++++++++++++++ pmg-index.html.tt | 3 ++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/js/LoginView.js b/js/LoginView.js index 8e610aa..5b95234 100644 --- a/js/LoginView.js +++ b/js/LoginView.js @@ -10,6 +10,8 @@ Ext.define('PMG.LoginView', { let realmfield = me.lookup('realmfield'); + me.lookup('quarantineButton').setVisible(!!Proxmox.QuarantineLink); + if (view.targetview !== 'quarantineview') { return; } @@ -65,6 +67,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 +100,9 @@ Ext.define('PMG.LoginView', { window.location.reload(); }, }, + 'button[reference=quarantineButton]': { + click: 'openQuarantineLinkWindow', + }, 'button[reference=loginButton]': { click: 'submitForm', }, @@ -172,6 +199,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