From: Dominik Csapak <d.csapak@proxmox.com>
To: pmg-devel@lists.proxmox.com
Subject: [pmg-devel] [PATCH pmg-gui v2 1/1] add 'Request Quarantine Link' Button to LoginView
Date: Tue, 17 Nov 2020 15:57:43 +0100 [thread overview]
Message-ID: <20201117145743.10561-5-d.csapak@proxmox.com> (raw)
In-Reply-To: <20201117145743.10561-1-d.csapak@proxmox.com>
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 <d.csapak@proxmox.com>
---
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 %],
};
</script>
<script type="text/javascript" src="/proxmoxlib.js?ver=[% wtversion %]"></script>
--
2.20.1
next prev parent reply other threads:[~2020-11-17 14:58 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-17 14:57 [pmg-devel] [PATCH pmg-api/gui] add quarantine self service button Dominik Csapak
2020-11-17 14:57 ` [pmg-devel] [PATCH pmg-api v2 1/3] refactor domain_regex to Utils Dominik Csapak
2020-11-17 14:57 ` [pmg-devel] [PATCH pmg-api v2 2/3] add 'quarantinelink' to spamquar config Dominik Csapak
2020-11-17 14:57 ` [pmg-devel] [PATCH pmg-api v2 3/3] api2/quarantine: add global sendlink api call Dominik Csapak
2020-11-17 14:57 ` Dominik Csapak [this message]
2020-11-17 15:29 ` [pmg-devel] [PATCH pmg-api/gui] add quarantine self service button Thomas Lamprecht
2020-11-17 15:53 ` Dominik Csapak
2020-11-17 16:11 ` Thomas Lamprecht
2020-11-17 16:00 ` Stoiko Ivanov
2020-11-17 16:27 ` Dietmar Maurer
2020-11-17 16:38 ` Dietmar Maurer
2020-11-18 7:44 ` Thomas Lamprecht
2020-11-18 7:56 ` Dominik Csapak
2020-11-18 8:01 ` Thomas Lamprecht
2020-11-18 8:13 ` Dominik Csapak
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=20201117145743.10561-5-d.csapak@proxmox.com \
--to=d.csapak@proxmox.com \
--cc=pmg-devel@lists.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox