]> git.proxmox.com Git - proxmox-widget-toolkit.git/commitdiff
toolkit: override email VType validation
authorStoiko Ivanov <s.ivanov@proxmox.com>
Thu, 8 Apr 2021 12:41:18 +0000 (14:41 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 13 Apr 2021 07:09:23 +0000 (09:09 +0200)
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@test.systems(|test)? on my test-installation)

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

index b011c384e41422d24c9d817e32b5c7c760a07a4c..6ae31ed45b96355ab2e8e5fa405259fd1171dedd 100644 (file)
@@ -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