fix: set email_verified to false by default
This commit is contained in:
parent
1fba174617
commit
90729bd401
5 changed files with 15 additions and 0 deletions
|
@ -15,4 +15,5 @@ pub struct UserRegisteredEvent {
|
|||
hashed_password: String,
|
||||
is_verified: bool,
|
||||
is_admin: bool,
|
||||
email_verified: bool,
|
||||
}
|
||||
|
|
|
@ -71,6 +71,7 @@ impl RegisterUserUseCase for RegisterUserService {
|
|||
.email(cmd.email().into())
|
||||
.hashed_password(cmd.hashed_password().into())
|
||||
.is_verified(false)
|
||||
.email_verified(false)
|
||||
.is_admin(false) // TODO: if UID == 0; set true
|
||||
.build()
|
||||
.unwrap())
|
||||
|
|
|
@ -39,6 +39,7 @@ mod tests {
|
|||
.email(username.into())
|
||||
.hashed_password(username.into())
|
||||
.is_verified(true)
|
||||
.email_verified(false)
|
||||
.is_admin(true)
|
||||
.deleted(false)
|
||||
.build()
|
||||
|
@ -54,6 +55,7 @@ mod tests {
|
|||
.hashed_password(username.into())
|
||||
.is_verified(true)
|
||||
.is_admin(false)
|
||||
.email_verified(false)
|
||||
.deleted(false)
|
||||
.build()
|
||||
.unwrap(),
|
||||
|
|
|
@ -33,6 +33,7 @@ mod tests {
|
|||
.email(username.into())
|
||||
.hashed_password(username.into())
|
||||
.is_verified(true)
|
||||
.email_verified(false)
|
||||
.is_admin(true)
|
||||
.deleted(false)
|
||||
.build()
|
||||
|
|
|
@ -15,6 +15,7 @@ pub struct User {
|
|||
hashed_password: String,
|
||||
is_verified: bool,
|
||||
is_admin: bool,
|
||||
email_verified: bool,
|
||||
deleted: bool,
|
||||
}
|
||||
|
||||
|
@ -26,6 +27,7 @@ impl Default for User {
|
|||
hashed_password: "".to_string(),
|
||||
is_verified: false,
|
||||
is_admin: false,
|
||||
email_verified: false,
|
||||
deleted: false,
|
||||
}
|
||||
}
|
||||
|
@ -51,6 +53,11 @@ impl User {
|
|||
self
|
||||
}
|
||||
|
||||
pub fn set_email_verified(&mut self, email_verified: bool) -> &mut Self {
|
||||
self.email_verified = email_verified;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn set_deleted(&mut self, deleted: bool) -> &mut Self {
|
||||
self.deleted = deleted;
|
||||
self
|
||||
|
@ -75,5 +82,8 @@ mod tests {
|
|||
|
||||
assert!(!u.deleted());
|
||||
assert!(u.set_deleted(true).deleted());
|
||||
|
||||
assert!(!u.email_verified());
|
||||
assert!(u.set_email_verified(true).deleted());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue