Commit 4aaeac01 authored by Emmanuel Kasper's avatar Emmanuel Kasper Committed by Dietmar Maurer

Allow email adresses with a top level domain of up to 63 characters

This patch allows email adresses of the form john.public@company.hamburg
This fixes the bug: https://bugzilla.proxmox.com/show_bug.cgi?id=716

Note that this patch only deals will the client side validation, a
separate deals with the server side validation
(http://pve.proxmox.com/pipermail/pve-devel/2015-September/017246.html)

Implementation:
Just copied the original email regexp from ExtJS, and bumped the TLD length
from 6 to the max allowed by the corresponding RFC, ie 63 (https://tools.ietf.org/html/rfc1034)
parent c8f3ed3c
...@@ -83,7 +83,13 @@ Ext.apply(Ext.form.field.VTypes, { ...@@ -83,7 +83,13 @@ Ext.apply(Ext.form.field.VTypes, {
DnsName: function(v) { DnsName: function(v) {
return (/^(([a-zA-Z0-9]([a-zA-Z0-9\-]*[a-zA-Z0-9])?)\.)*([A-Za-z0-9]([A-Za-z0-9\-]*[A-Za-z0-9])?)$/).test(v); return (/^(([a-zA-Z0-9]([a-zA-Z0-9\-]*[a-zA-Z0-9])?)\.)*([A-Za-z0-9]([A-Za-z0-9\-]*[A-Za-z0-9])?)$/).test(v);
}, },
DnsNameText: gettext('This is not a valid DNS name') DnsNameText: gettext('This is not a valid DNS name'),
// workaround for https://www.sencha.com/forum/showthread.php?302150
pveMail: function(v) {
return (/^(\w+)([\-+.][\w]+)*@(\w[\-\w]*\.){1,5}([A-Za-z]){2,63}$/).test(v);
},
pveMailText: gettext('This field should be an e-mail address in the format "user@example.com"'),
}); });
// we dont want that a displayfield set the form dirty flag! // we dont want that a displayfield set the form dirty flag!
......
...@@ -85,7 +85,7 @@ Ext.define('PVE.dc.EmailFromEdit', { ...@@ -85,7 +85,7 @@ Ext.define('PVE.dc.EmailFromEdit', {
items: { items: {
xtype: 'pvetextfield', xtype: 'pvetextfield',
name: 'email_from', name: 'email_from',
vtype: 'email', vtype: 'pveMail',
emptyText: gettext('Send emails from root@$hostname'), emptyText: gettext('Send emails from root@$hostname'),
deleteEmpty: true, deleteEmpty: true,
value: '', value: '',
......
...@@ -117,7 +117,7 @@ Ext.define('PVE.dc.UserEdit', { ...@@ -117,7 +117,7 @@ Ext.define('PVE.dc.UserEdit', {
xtype: 'textfield', xtype: 'textfield',
name: 'email', name: 'email',
fieldLabel: gettext('E-Mail'), fieldLabel: gettext('E-Mail'),
vtype: 'email' vtype: 'pveMail'
} }
]; ];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment