[pve-devel] [PATCH installer] restrict admin email to same format as the JSONSchema

Dominik Csapak d.csapak at proxmox.com
Thu Nov 28 13:39:56 CET 2019


Use the same regex as the 'email' format in JSONSchema (copied from there).
Otherwise, users can enter an email address which does not match our
schema and breaks the userlist API Call with a 'return value
verification failed', and one cannot rectify this via the gui
(the user has to manually edit the user.cfg or set the email via
pveum)

i noticed this while testing and using the 'insert emoji' menu in the
context menu

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 proxinstall | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/proxinstall b/proxinstall
index 399faa4..3e24729 100755
--- a/proxinstall
+++ b/proxinstall
@@ -2586,7 +2586,7 @@ sub create_password_view {
 	}
 
 	my $t3 = $eme->get_text;
-	if ($t3 !~ m/^\S+\@\S+\.\S+$/) {
+	if ($t3 !~ m/^[\w\+\-\~]+(\.[\w\+\-\~]+)*@[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)*$/) {
 	    display_message("E-Mail does not look like a valid address" .
 			     " (user\@domain.tld)");
 	    $eme->grab_focus();
-- 
2.20.1





More information about the pve-devel mailing list