utils: add custom validator for pmg-email-address

matching the pattern in the backend (allowing most characters inside
of e-mail addresses.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
This commit is contained in:
Stoiko Ivanov 2022-11-23 10:23:35 +01:00 committed by Thomas Lamprecht
parent ea785e3f7b
commit 845efd4177
2 changed files with 10 additions and 1 deletions

View File

@ -127,7 +127,7 @@ Ext.define('PMG.UserBlackWhiteList', {
{
xtype: 'combobox',
displayField: 'mail',
vtype: 'email',
vtype: 'proxmoxMail',
allowBlank: false,
valueField: 'mail',
store: {

View 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",
});