[pve-devel] [PATCH widget-toolkit] toolkit: override email VType validation

Stoiko Ivanov s.ivanov at proxmox.com
Thu Apr 8 14:41:18 CEST 2021


ExtJS email validation regex has a length limit of 6 on the TLD.
This breaks some new gTLDs (e.g. .systems)

Override the validation function and verify against the EMAILRE from
PVE::Tools (used for 'e-mail' in JSONSchema)

Reported in our community forum:
https://forum.proxmox.com/threads/acme-account-register-dialog-does-not-accept-gtlds.87305/

Quickly tested (by using test at test.systems(|test)? on my test-installation)

Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
 src/Toolkit.js | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/Toolkit.js b/src/Toolkit.js
index b011c38..6ae31ed 100644
--- a/src/Toolkit.js
+++ b/src/Toolkit.js
@@ -182,6 +182,11 @@ Ext.apply(Ext.form.field.VTypes, {
     },
 
     passwordText: gettext('Passwords do not match'),
+
+    email: function(value) {
+	let emailre = /^[\w+~-]+(\.[\w+~-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)$/;
+	return emailre.test(value);
+    },
 });
 
 // Firefox 52+ Touchscreen bug
-- 
2.20.1






More information about the pve-devel mailing list