* [PATCH datacenter-manager/installer/proxmox 0/3] use correct email validation in auto-installer ui
@ 2026-05-27 13:05 Dominik Csapak
2026-05-27 13:05 ` [PATCH proxmox 1/3] installer types: move email validation from proxmox-installer-common Dominik Csapak
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Dominik Csapak @ 2026-05-27 13:05 UTC (permalink / raw)
To: pdm-devel
to do that we move the email validation from the installer-common crate
to the installer-types crate which is accessible from PDM too.
Not super sure about the deps for proxmox-installer-types, but I guess
it doesn't make a difference if we always add the schema/regex
dependency or depend on the 'api-types' feature in pve-installer
proxmox:
Dominik Csapak (1):
installer types: move email validation from proxmox-installer-common
proxmox-installer-types/Cargo.toml | 6 +++---
proxmox-installer-types/src/answer.rs | 22 ++++++++++++++++++++++
2 files changed, 25 insertions(+), 3 deletions(-)
pve-installer:
Dominik Csapak (1):
use email validation from installer-types
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(-)
proxmox-datacenter-manager:
Dominik Csapak (1):
ui: auto-installer: use email validation from installer-types
.../remotes/auto_installer/prepared_answer_form.rs | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
Summary over all repositories:
6 files changed, 33 insertions(+), 41 deletions(-)
--
Generated by murpp 0.11.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH proxmox 1/3] installer types: move email validation from proxmox-installer-common
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 ` Dominik Csapak
2026-05-27 13:05 ` [PATCH pve-installer 2/3] use email validation from installer-types Dominik Csapak
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Dominik Csapak @ 2026-05-27 13:05 UTC (permalink / raw)
To: pdm-devel
we want to use this not only in the installer itself but also e.g. in
PDM which can generate answer files.
Since we don't only want this when we have the api types, move the
proxmox-schema and regex dependencies from the api-types feature.
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
proxmox-installer-types/Cargo.toml | 6 +++---
proxmox-installer-types/src/answer.rs | 22 ++++++++++++++++++++++
2 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/proxmox-installer-types/Cargo.toml b/proxmox-installer-types/Cargo.toml
index 4526b47f..5b0b489c 100644
--- a/proxmox-installer-types/Cargo.toml
+++ b/proxmox-installer-types/Cargo.toml
@@ -15,15 +15,15 @@ rust-version.workspace = true
anyhow.workspace = true
serde = { workspace = true, features = ["derive"] }
serde_plain.workspace = true
-regex = { workspace = true, optional = true }
+regex = { workspace = true }
proxmox-network-types.workspace = true
-proxmox-schema = { workspace = true, optional = true, features = ["api-macro"] }
+proxmox-schema = { workspace = true, features = ["api-macro"] }
proxmox-section-config = { workspace = true, optional = true }
proxmox-node-status.workspace = true
[features]
default = []
-api-types = ["dep:regex", "dep:proxmox-schema", "dep:proxmox-section-config", "proxmox-network-types/api-types"]
+api-types = ["dep:proxmox-section-config", "proxmox-network-types/api-types"]
# enable old-style answer file keys with underscores for backwards compatibility
legacy = []
diff --git a/proxmox-installer-types/src/answer.rs b/proxmox-installer-types/src/answer.rs
index 9c6317ae..8bb9f0dd 100644
--- a/proxmox-installer-types/src/answer.rs
+++ b/proxmox-installer-types/src/answer.rs
@@ -41,6 +41,17 @@ proxmox_schema::const_regex! {
pub SUBSCRIPTION_KEY_REGEX = r"^(?:pve[0-9]+|pbs|pmg)[cbsp]-[0-9a-f]{10}$";
}
+proxmox_schema::const_regex! {
+ /// 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 EMAIL_REGEX = 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])?)*$";
+}
+
/// Schema for an optional Proxmox subscription key.
#[cfg(feature = "api-types")]
pub const SUBSCRIPTION_KEY_SCHEMA: proxmox_schema::Schema =
@@ -1229,3 +1240,14 @@ where
_ => Ok(None),
}
}
+
+/// Validates an email address according to [EMAIL_REGEX]
+pub fn email_validate(email: &str) -> Result<()> {
+ if !EMAIL_REGEX.is_match(email) {
+ bail!("Email does not look like a valid address (user@domain.tld)")
+ } else if email == crate::EMAIL_DEFAULT_PLACEHOLDER {
+ bail!("Invalid (default) email address")
+ }
+
+ Ok(())
+}
--
2.47.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH pve-installer 2/3] use email validation from installer-types
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
2026-05-27 13:05 ` [PATCH datacenter-manager 3/3] ui: auto-installer: " 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
3 siblings, 0 replies; 5+ messages in thread
From: Dominik Csapak @ 2026-05-27 13:05 UTC (permalink / raw)
To: pdm-devel
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH datacenter-manager 3/3] ui: auto-installer: use email validation from installer-types
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 ` [PATCH pve-installer 2/3] use email validation from installer-types Dominik Csapak
@ 2026-05-27 13:05 ` 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
3 siblings, 0 replies; 5+ messages in thread
From: Dominik Csapak @ 2026-05-27 13:05 UTC (permalink / raw)
To: pdm-devel
so we have the same check for the installer here in the ui. this way it
can't happen that the user enters an email address which the installer
itself rejects.
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
.../remotes/auto_installer/prepared_answer_form.rs | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/ui/src/remotes/auto_installer/prepared_answer_form.rs b/ui/src/remotes/auto_installer/prepared_answer_form.rs
index 477a71f7..6d5c796b 100644
--- a/ui/src/remotes/auto_installer/prepared_answer_form.rs
+++ b/ui/src/remotes/auto_installer/prepared_answer_form.rs
@@ -15,9 +15,9 @@ use pdm_api_types::{
};
use proxmox_installer_types::{
answer::{
- BtrfsCompressOption, BtrfsOptions, FilesystemOptions, FilesystemType, FilterMatch,
- KeyboardLayout, LvmOptions, RebootMode, ZfsChecksumOption, ZfsCompressOption, ZfsOptions,
- BTRFS_COMPRESS_OPTIONS, FILESYSTEM_TYPE_OPTIONS, ROOT_PASSWORD_SCHEMA,
+ email_validate, BtrfsCompressOption, BtrfsOptions, FilesystemOptions, FilesystemType,
+ FilterMatch, KeyboardLayout, LvmOptions, RebootMode, ZfsChecksumOption, ZfsCompressOption,
+ ZfsOptions, BTRFS_COMPRESS_OPTIONS, FILESYSTEM_TYPE_OPTIONS, ROOT_PASSWORD_SCHEMA,
SUBSCRIPTION_KEY_SCHEMA, ZFS_CHECKSUM_OPTIONS, ZFS_COMPRESS_OPTIONS,
},
EMAIL_DEFAULT_PLACEHOLDER,
@@ -260,13 +260,7 @@ pub fn render_global_options_form(
.input_type(InputType::Email)
.value(config.mailto.clone())
.schema(&EMAIL_SCHEMA)
- .validate(|s: &String| {
- if s.ends_with(".invalid") {
- bail!(tr!("Invalid (default) email address"))
- } else {
- Ok(())
- }
- })
+ .validate(|email: &String| email_validate(email))
.required(true),
)
.with_field(
--
2.47.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* partially-applied: [PATCH datacenter-manager/installer/proxmox 0/3] use correct email validation in auto-installer ui
2026-05-27 13:05 [PATCH datacenter-manager/installer/proxmox 0/3] use correct email validation in auto-installer ui Dominik Csapak
` (2 preceding siblings ...)
2026-05-27 13:05 ` [PATCH datacenter-manager 3/3] ui: auto-installer: " Dominik Csapak
@ 2026-05-28 11:00 ` Thomas Lamprecht
3 siblings, 0 replies; 5+ messages in thread
From: Thomas Lamprecht @ 2026-05-28 11:00 UTC (permalink / raw)
To: pdm-devel, Dominik Csapak
On Wed, 27 May 2026 15:05:56 +0200, Dominik Csapak wrote:
> to do that we move the email validation from the installer-common crate
> to the installer-types crate which is accessible from PDM too.
>
> Not super sure about the deps for proxmox-installer-types, but I guess
> it doesn't make a difference if we always add the schema/regex
> dependency or depend on the 'api-types' feature in pve-installer
>
> [...]
Applied the proxmox part, thanks!
Nit: I'd have appreciated if your commit message explained for why we "don't
only want this when we have the api types" in the commit message.
[proxmox]
[1/1] installer types: move email validation from proxmox-installer-common
commit: b9bc28082f820dbf88f8dcc02ba2250fc999f9d0
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-05-28 11:00 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH pve-installer 2/3] use email validation from installer-types Dominik Csapak
2026-05-27 13:05 ` [PATCH datacenter-manager 3/3] ui: auto-installer: " 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
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.