]> Untitled Git - lemmy.git/blobdiff - crates/api_common/src/person.rs
First pass at invite-only migration. (#1949)
[lemmy.git] / crates / api_common / src / person.rs
index 5dddc5dcceb6f7511517dcf24efcd25b0dfec6e4..47c26591e2c7bf88279956e224f5e77ec1e99b9a 100644 (file)
@@ -24,10 +24,13 @@ pub struct Register {
   pub password: Sensitive<String>,
   pub password_verify: Sensitive<String>,
   pub show_nsfw: bool,
+  /// email is mandatory if email verification is enabled on the server
   pub email: Option<Sensitive<String>>,
   pub captcha_uuid: Option<String>,
   pub captcha_answer: Option<String>,
   pub honeypot: Option<String>,
+  /// An answer is mandatory if require application is enabled on the server
+  pub answer: Option<String>,
 }
 
 #[derive(Debug, Serialize, Deserialize)]
@@ -78,7 +81,10 @@ pub struct ChangePassword {
 
 #[derive(Debug, Serialize, Deserialize)]
 pub struct LoginResponse {
-  pub jwt: Sensitive<String>,
+  /// This is None in response to `Register` if email verification is enabled, or the server requires registration applications.
+  pub jwt: Option<Sensitive<String>>,
+  pub registration_created: bool,
+  pub verify_email_sent: bool,
 }
 
 #[derive(Debug, Serialize, Deserialize)]
@@ -194,6 +200,9 @@ pub struct DeleteAccount {
   pub auth: Sensitive<String>,
 }
 
+#[derive(Debug, Serialize, Deserialize, Clone)]
+pub struct DeleteAccountResponse {}
+
 #[derive(Debug, Serialize, Deserialize)]
 pub struct PasswordReset {
   pub email: Sensitive<String>,
@@ -279,3 +288,11 @@ pub struct GetUnreadCountResponse {
   pub mentions: i64,
   pub private_messages: i64,
 }
+
+#[derive(Serialize, Deserialize)]
+pub struct VerifyEmail {
+  pub token: String,
+}
+
+#[derive(Debug, Serialize, Deserialize, Clone)]
+pub struct VerifyEmailResponse {}