From: Dominik Csapak <d.csapak@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [PATCH pve-installer 2/3] use email validation from installer-types
Date: Wed, 27 May 2026 15:05:58 +0200 [thread overview]
Message-ID: <20260527130611.2995147-3-d.csapak@proxmox.com> (raw)
In-Reply-To: <20260527130611.2995147-1-d.csapak@proxmox.com>
was moved there so no need to have it here.
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
proxmox-auto-installer/src/utils.rs | 4 ++--
proxmox-installer-common/src/options.rs | 22 ----------------------
proxmox-tui-installer/src/main.rs | 6 ++----
3 files changed, 4 insertions(+), 28 deletions(-)
diff --git a/proxmox-auto-installer/src/utils.rs b/proxmox-auto-installer/src/utils.rs
index 710af21..a3a07d1 100644
--- a/proxmox-auto-installer/src/utils.rs
+++ b/proxmox-auto-installer/src/utils.rs
@@ -11,14 +11,14 @@ use proxmox_installer_types::{
answer::{
AutoInstallerConfig, DiskSelection, Filesystem, FilesystemOptions, FilesystemType,
FilterMatch, FirstBootHookSourceMode, FqdnConfig, FqdnFromDhcpConfig, FqdnSourceMode,
- NetworkConfig,
+ NetworkConfig, email_validate,
},
};
use proxmox_installer_common::{
ROOT_PASSWORD_MIN_LENGTH,
disk_checks::check_swapsize,
- options::{FilesystemDiskInfo, NetworkInterfacePinningOptions, NetworkOptions, email_validate},
+ options::{FilesystemDiskInfo, NetworkInterfacePinningOptions, NetworkOptions},
setup::{
InstallBtrfsOption, InstallConfig, InstallFirstBootSetup, InstallRootPassword,
InstallZfsOption, LocaleInfo, RuntimeInfo, SetupInfo,
diff --git a/proxmox-installer-common/src/options.rs b/proxmox-installer-common/src/options.rs
index 4014c29..220e8cd 100644
--- a/proxmox-installer-common/src/options.rs
+++ b/proxmox-installer-common/src/options.rs
@@ -519,28 +519,6 @@ impl NetworkOptions {
}
}
-/// Validates an email address using the regex for `<input type="email" />` elements
-/// as defined in the [HTML specification].
-/// Using that /should/ cover all possible cases that are encountered in the wild.
-///
-/// It additionally checks whether the email our default email placeholder value.
-///
-/// [HTML specification]: <https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address>
-pub fn email_validate(email: &str) -> Result<()> {
- static RE: OnceLock<Regex> = OnceLock::new();
- let re = RE.get_or_init(|| {
- Regex::new(r"^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$").unwrap()
- });
-
- if !re.is_match(email) {
- bail!("Email does not look like a valid address (user@domain.tld)")
- } else if email == EMAIL_DEFAULT_PLACEHOLDER {
- bail!("Invalid (default) email address")
- }
-
- Ok(())
-}
-
#[cfg(test)]
mod tests {
use super::*;
diff --git a/proxmox-tui-installer/src/main.rs b/proxmox-tui-installer/src/main.rs
index 6c457aa..9af6bb1 100644
--- a/proxmox-tui-installer/src/main.rs
+++ b/proxmox-tui-installer/src/main.rs
@@ -15,13 +15,11 @@ use cursive::{
use proxmox_installer_common::{
ROOT_PASSWORD_MIN_LENGTH,
- options::{
- BootdiskOptions, NetworkInterfacePinningOptions, NetworkOptions, TimezoneOptions,
- email_validate,
- },
+ options::{BootdiskOptions, NetworkInterfacePinningOptions, NetworkOptions, TimezoneOptions},
setup::{LocaleInfo, RuntimeInfo, SetupInfo, installer_setup},
};
use proxmox_installer_types::ProxmoxProduct;
+use proxmox_installer_types::answer::email_validate;
mod options;
use options::{InstallerOptions, PasswordOptions};
--
2.47.3
next prev parent reply other threads:[~2026-05-27 13:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-27 13:05 [PATCH datacenter-manager/installer/proxmox 0/3] use correct email validation in auto-installer ui Dominik Csapak
2026-05-27 13:05 ` [PATCH proxmox 1/3] installer types: move email validation from proxmox-installer-common Dominik Csapak
2026-05-27 13:05 ` Dominik Csapak [this message]
2026-05-27 13:05 ` [PATCH datacenter-manager 3/3] ui: auto-installer: use email validation from installer-types Dominik Csapak
2026-05-28 11:00 ` partially-applied: [PATCH datacenter-manager/installer/proxmox 0/3] use correct email validation in auto-installer ui Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260527130611.2995147-3-d.csapak@proxmox.com \
--to=d.csapak@proxmox.com \
--cc=pdm-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox