-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: [#654] new registration confg section
Registration Disabled: ```toml ``` Registration without email option: ```toml [registration] ``` Registration optionally including an email address: ```toml [registration] [registration.email] ``` Registration with email: ```toml [registration] [registration.email] required = true ``` Registration with optional email, but if email is supplied it is verified: ```toml [registration] [registration.email] verified = true ``` Registration with email and email is verified: ```toml [registration] [registration.email] required = true verified = true ``` TODO: remove old settings and use the new ones.
- Loading branch information
1 parent
304221e
commit 1c5e862
Showing
8 changed files
with
156 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
use serde::{Deserialize, Serialize}; | ||
|
||
/// SMTP configuration. | ||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] | ||
pub struct Registration { | ||
/// Whether or not to enable email verification on signup. | ||
#[serde(default = "Registration::default_email")] | ||
pub email: Option<Email>, | ||
} | ||
|
||
impl Default for Registration { | ||
fn default() -> Self { | ||
Self { | ||
email: Self::default_email(), | ||
} | ||
} | ||
} | ||
|
||
impl Registration { | ||
fn default_email() -> Option<Email> { | ||
None | ||
} | ||
} | ||
|
||
/// SMTP configuration. | ||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] | ||
pub struct Email { | ||
/// Whether or not email is required on signup. | ||
#[serde(default = "Email::default_required")] | ||
pub required: bool, | ||
|
||
/// Whether or not email is verified. | ||
#[serde(default = "Email::default_verified")] | ||
pub verified: bool, | ||
} | ||
|
||
impl Default for Email { | ||
fn default() -> Self { | ||
Self { | ||
required: Self::default_required(), | ||
verified: Self::default_verified(), | ||
} | ||
} | ||
} | ||
|
||
impl Email { | ||
fn default_required() -> bool { | ||
false | ||
} | ||
|
||
fn default_verified() -> bool { | ||
false | ||
} | ||
} |