toolkit: override email VType validation

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>
This commit is contained in:
Stoiko Ivanov 2021-04-08 14:41:18 +02:00 committed by Thomas Lamprecht
parent 95bba12dec
commit dcd5a0c61f

View 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