]> git.proxmox.com Git - pmg-gui.git/commitdiff
add 'Request Quarantine Link' Button to LoginView
authorDominik Csapak <d.csapak@proxmox.com>
Wed, 18 Nov 2020 10:59:37 +0000 (11:59 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 18 Nov 2020 16:52:52 +0000 (17:52 +0100)
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
pmg-index.html.tt

index 8e610aab79b077cc4316111eda26a564cf32afc1..4770494d82f0f334a70dbf814d8e804532d61d30 100644 (file)
@@ -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,30 @@ 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',
+               isCreate: true,
+               submitText: gettext('OK'),
+               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',
index 4faf0cf3c0c6ad9b9f5490367aaa8679680fd00d..4a29ba2587a63e4765afe62b1caa914102b60f29 100644 (file)
@@ -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>