Skip to content

Commit 35528b4

Browse files
committed
feat: [#674] rename email config option
From: ```toml [registration] [registration.email] required = true verified = true ``` To: ```toml [registration] [registration.email] required = true verification_required = true ```
1 parent f41b725 commit 35528b4

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

src/config/v2/registration.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ pub struct Email {
3131

3232
/// Whether or not email is verified.
3333
#[serde(default = "Email::default_verified")]
34-
pub verified: bool,
34+
pub verification_required: bool,
3535
}
3636

3737
impl Default for Email {
3838
fn default() -> Self {
3939
Self {
4040
required: Self::default_required(),
41-
verified: Self::default_verified(),
41+
verification_required: Self::default_verified(),
4242
}
4343
}
4444
}

src/services/authentication.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ impl Service {
7272
// Fail login if email verification is required and this email is not verified
7373
if let Some(registration) = &settings.registration {
7474
if let Some(email) = &registration.email {
75-
if email.verified && !user_profile.email_verified {
75+
if email.verification_required && !user_profile.email_verified {
7676
return Err(ServiceError::EmailNotVerified);
7777
}
7878
}

src/services/user.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ impl RegistrationService {
136136

137137
match &registration.email {
138138
Some(email) => {
139-
if email.verified {
139+
if email.verification_required {
140140
// Email verification is enabled
141141
if let Some(email) = opt_email {
142142
let mail_res = self

tests/common/contexts/settings/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ pub struct Registration {
113113
#[derive(Deserialize, Serialize, PartialEq, Debug, Clone)]
114114
pub struct Email {
115115
pub required: bool,
116-
pub verified: bool,
116+
pub verification_required: bool,
117117
}
118118

119119
#[derive(Deserialize, Serialize, PartialEq, Debug, Clone)]
@@ -264,7 +264,7 @@ impl From<DomainEmail> for Email {
264264
fn from(email: DomainEmail) -> Self {
265265
Self {
266266
required: email.required,
267-
verified: email.verified,
267+
verification_required: email.verification_required,
268268
}
269269
}
270270
}

tests/environments/isolated.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ fn ephemeral(temp_dir: &TempDir) -> config::Settings {
9292
configuration.registration = Some(Registration {
9393
email: Some(Email {
9494
required: false,
95-
verified: false,
95+
verification_required: false,
9696
}),
9797
});
9898

0 commit comments

Comments
 (0)