Bootstrapping fixes

This commit is contained in:
Maurus Decimus
2026-04-20 16:35:21 +02:00
parent 170d0e95a6
commit 1edd85486b
16 changed files with 142 additions and 47 deletions

View File

@@ -18,7 +18,7 @@ pub enum Account {
#[serde(default)]
pub struct AccountPassword {
#[serde(rename = "secret")]
pub secret: String,
pub secret: Option<String>,
#[serde(rename = "currentSecret")]
pub current_secret: Option<String>,
#[serde(rename = "otpAuth")]

View File

@@ -119,9 +119,10 @@ impl ObjectImpl for AccountPassword {
fn validate(&self, errors: &mut Vec<ValidationError>) -> bool {
let neb = errors.len();
let value = &self.secret;
if value.is_empty() {
errors.push(ValidationError::required(Property::Secret));
if let Some(value) = &self.secret {
if value.is_empty() {
errors.push(ValidationError::required(Property::Secret));
}
}
if let Some(value) = &self.current_secret {
if value.is_empty() {
@@ -165,7 +166,9 @@ impl Default for AccountPassword {
impl IntoValue for AccountPassword {
fn into_value(self) -> JmapValue<'static> {
let mut map = jmap_tools::Map::with_capacity(5);
map.insert_unchecked(Property::Secret, JmapValue::Str(MASKED_PASSWORD.into()));
if self.secret.is_some() {
map.insert_unchecked(Property::Secret, JmapValue::Str(MASKED_PASSWORD.into()));
}
if self.current_secret.is_some() {
map.insert_unchecked(
Property::CurrentSecret,