On Tue, 26 Feb 2019 13:33:02 +0100 Oguz Bektas <o.bek...@proxmox.com> wrote:
> for matching root@localhost or similar. > > Signed-off-by: Oguz Bektas <o.bek...@proxmox.com> > --- > src/PVE/JSONSchema.pm | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/src/PVE/JSONSchema.pm b/src/PVE/JSONSchema.pm > index 36fa994..9820649 100644 > --- a/src/PVE/JSONSchema.pm > +++ b/src/PVE/JSONSchema.pm > @@ -356,8 +356,7 @@ register_format('email', \&pve_verify_email); > sub pve_verify_email { > my ($email, $noerr) = @_; > > - # we use same regex as in Utils.js > - if > ($email !~ /^(\w+)([\-+.][\w]+)*@(\w[\-\w]*\.){1,5}([A-Za-z]){2,63}$/) > { > + if > ($email !~ /^(\w+)([\-+.]\w+)*@(\w[\-\w]*\.){0,5}([A-Za-z]){2,63}$/) > { return undef if $noerr; die "value does not look like a valid email > address\n"; } hm - a quick check of [0], would suggest that for the 'host' part of the e-mail we might want to: * use [-a-zA-Z0-9] for all components of a hostname (only ASCII alphanumerics and '-' * the limitation to maximum of 5 subdomain-entries seems arbitrary (although even my longest e-mail-address has only five subdomain-entries) * why do we restrict the subdomains to have at least 2 characters? - would allow for 1 character subdomains as well for the localpart the regex seems a bit complex - if I read it right we want it to: * start with a word-character (\w) and afterwards a combination of \w|[-+.] This sounds somewhat reasonable to me, but I would write it as: '\w([-+.]\w)*' [0]https://en.wikipedia.org/wiki/Domain_Name_System _______________________________________________ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel