public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH widget-toolkit] fix: toolkit: make email regex pattern match pve-common
@ 2022-09-07  9:37 Stefan Sterz
  2022-09-12 15:15 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Sterz @ 2022-09-07  9:37 UTC (permalink / raw)
  To: pve-devel

`proxmoxMail` used its own regex pattern to validate emails. that
meant certain email addresses were rejected by the front-end that
were accepted by the backend that uses the functionality from
`pve-common`. examples include the following:

- "user@host.test-tld"
- "user-@host.testtld"
- "user@host"

reported on the forum: https://forum.proxmox.com/threads/gui-bugulance-using-the-user-add-gui-interface.114743/

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
---
note that there are many many regex patterns that could be used
(e.g.: [1]). im partial to w3c's approach [2], mainly because it's
likely to be widely used, while being fairly simple and compatible
with perl and javascript.

[1]: https://www.ex-parrot.com/~pdw/Mail-RFC822-Address.html
[2]: https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address

 src/Toolkit.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/Toolkit.js b/src/Toolkit.js
index ad64f89..c730374 100644
--- a/src/Toolkit.js
+++ b/src/Toolkit.js
@@ -131,9 +131,9 @@ Ext.apply(Ext.form.field.VTypes, {
     },
     DnsNameOrWildcardText: gettext('This is not a valid DNS name'),
 
-    // workaround for https://www.sencha.com/forum/showthread.php?302150
+    // email regex used by pve-common
     proxmoxMail: function(v) {
-        return (/^(\w+)([-+.][\w]+)*@(\w[-\w]*\.){1,5}([A-Za-z]){2,63}$/).test(v);
+        return (/^[\w+-~]+(\.[\w+-~]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*$/).test(v);
     },
     proxmoxMailText: gettext('Example') + ": user@example.com",
 
-- 
2.30.2





^ permalink raw reply	[flat|nested] 2+ messages in thread

* [pve-devel] applied: [PATCH widget-toolkit] fix: toolkit: make email regex pattern match pve-common
  2022-09-07  9:37 [pve-devel] [PATCH widget-toolkit] fix: toolkit: make email regex pattern match pve-common Stefan Sterz
@ 2022-09-12 15:15 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2022-09-12 15:15 UTC (permalink / raw)
  To: Proxmox VE development discussion, Stefan Sterz

Am 07/09/2022 um 11:37 schrieb Stefan Sterz:
> `proxmoxMail` used its own regex pattern to validate emails. that
> meant certain email addresses were rejected by the front-end that
> were accepted by the backend that uses the functionality from
> `pve-common`. examples include the following:
> 
> - "user@host.test-tld"
> - "user-@host.testtld"
> - "user@host"
> 
> reported on the forum: https://forum.proxmox.com/threads/gui-bugulance-using-the-user-add-gui-interface.114743/
> 
> Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
> ---
> note that there are many many regex patterns that could be used
> (e.g.: [1]). im partial to w3c's approach [2], mainly because it's
> likely to be widely used, while being fairly simple and compatible
> with perl and javascript.
> 
> [1]: https://www.ex-parrot.com/~pdw/Mail-RFC822-Address.html
> [2]: https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address
> 
>  src/Toolkit.js | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
>

applied, thanks!




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-09-12 15:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-07  9:37 [pve-devel] [PATCH widget-toolkit] fix: toolkit: make email regex pattern match pve-common Stefan Sterz
2022-09-12 15:15 ` [pve-devel] applied: " Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal