]> git.proxmox.com Git - pmg-gui.git/commitdiff
utils: add custom validator for pmg-email-address
authorStoiko Ivanov <s.ivanov@proxmox.com>
Wed, 23 Nov 2022 09:23:35 +0000 (10:23 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 25 Nov 2022 14:26:38 +0000 (15:26 +0100)
matching the pattern in the backend (allowing most characters inside
of e-mail addresses.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
js/UserBlackWhiteList.js
js/Utils.js

index 4f4a756563294f82434f08d8c3085c03411c43a6..44d75b389eeda74dce9962eaf857584dd7fd4ab3 100644 (file)
@@ -127,7 +127,7 @@ Ext.define('PMG.UserBlackWhiteList', {
        {
            xtype: 'combobox',
            displayField: 'mail',
-           vtype: 'email',
+           vtype: 'proxmoxMail',
            allowBlank: false,
            valueField: 'mail',
            store: {
index dc924d2c4344b23abf2de528161868ef8b7ada88..7fa154eab560ca075be83ca859de9614132eac3b 100644 (file)
@@ -898,3 +898,12 @@ Ext.define('PMG.Async', {
        );
     },
 });
+
+// custom Vtypes
+Ext.apply(Ext.form.field.VTypes, {
+    // matches the pmg-email-address in pmg-api
+    PMGMail: function(v) {
+       return (/[^\s\\@]+@[^\s/\\@]+/).test(v);
+    },
+    PMGMailText: gettext('Example') + ": user@example.com",
+});