feat: verify updated email address #23

Merged
realaravinth merged 2 commits from verify-updated-email into master 2024-07-12 18:02:45 +05:30
5 changed files with 15 additions and 0 deletions
Showing only changes of commit 90729bd401 - Show all commits

View file

@ -15,4 +15,5 @@ pub struct UserRegisteredEvent {
hashed_password: String,
is_verified: bool,
is_admin: bool,
email_verified: bool,
}

View file

@ -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())

View file

@ -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(),

View file

@ -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()

View file

@ -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());
}
}