cyaxon_authifier/models/
account.rs1use iso8601_timestamp::Timestamp;
2
3use super::MultiFactorAuthentication;
4
5#[derive(Debug, Serialize, Deserialize, Clone)]
7#[serde(tag = "status")]
8pub enum EmailVerification {
9 Verified,
11 Pending { token: String, expiry: Timestamp },
13 Moving {
15 new_email: String,
16 token: String,
17 expiry: Timestamp,
18 },
19}
20
21#[derive(Debug, Serialize, Deserialize, Clone)]
23pub struct PasswordReset {
24 pub token: String,
26 pub expiry: Timestamp,
28}
29
30#[derive(Debug, Serialize, Deserialize, Clone)]
32#[serde(tag = "status")]
33pub enum DeletionInfo {
34 WaitingForVerification { token: String, expiry: Timestamp },
36 Scheduled { after: Timestamp },
38 Deleted,
40}
41
42#[derive(Debug, Serialize, Deserialize, Clone)]
44pub struct Lockout {
45 pub attempts: i32,
47 pub expiry: Option<Timestamp>,
49}
50
51#[derive(Debug, Serialize, Deserialize, Clone)]
53pub struct Account {
54 #[serde(rename = "_id")]
56 pub id: String,
57
58 pub email: String,
60
61 pub email_normalized: String,
63
64 pub password: String,
66
67 #[serde(default)]
69 pub disabled: bool,
70
71 pub verification: EmailVerification,
73
74 pub password_reset: Option<PasswordReset>,
76
77 pub deletion: Option<DeletionInfo>,
79
80 pub lockout: Option<Lockout>,
82
83 pub mfa: MultiFactorAuthentication,
85}