[pve-devel] [PATCH v4 common] fix #2111: regex match for email addresses

Thomas Lamprecht t.lamprecht at proxmox.com
Fri Mar 1 10:39:58 CET 2019


On 2/28/19 3:00 PM, Oguz Bektas wrote:
> now allows:
> * addresses without tld (f.e. user at localhost per bug)
> * remove limits for number of subdomains
> * allow +, -, ~ in local part
> 
> v4:
> * disallow double dots (.. .a. etc) and dots in the end (abc. at mail.com)

applied, but again, you put version information directly in the commit
message. As already stated, don't do that, the commit message is, most of the
time, revision independent, it's only, valuable, information belonging below
in the from git ignored stat area...

> 
> Signed-off-by: Oguz Bektas <o.bektas at 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..1e3bf5d 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\+\-\~]+)*@[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)*$/) {
>  	   return undef if $noerr;
>  	   die "value does not look like a valid email address\n";
>      }
> 





More information about the pve-devel mailing list