feat: verify updated email address #23
5 changed files with 15 additions and 0 deletions
|
@ -15,4 +15,5 @@ pub struct UserRegisteredEvent {
|
||||||
hashed_password: String,
|
hashed_password: String,
|
||||||
is_verified: bool,
|
is_verified: bool,
|
||||||
is_admin: bool,
|
is_admin: bool,
|
||||||
|
email_verified: bool,
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,6 +71,7 @@ impl RegisterUserUseCase for RegisterUserService {
|
||||||
.email(cmd.email().into())
|
.email(cmd.email().into())
|
||||||
.hashed_password(cmd.hashed_password().into())
|
.hashed_password(cmd.hashed_password().into())
|
||||||
.is_verified(false)
|
.is_verified(false)
|
||||||
|
.email_verified(false)
|
||||||
.is_admin(false) // TODO: if UID == 0; set true
|
.is_admin(false) // TODO: if UID == 0; set true
|
||||||
.build()
|
.build()
|
||||||
.unwrap())
|
.unwrap())
|
||||||
|
|
|
@ -39,6 +39,7 @@ mod tests {
|
||||||
.email(username.into())
|
.email(username.into())
|
||||||
.hashed_password(username.into())
|
.hashed_password(username.into())
|
||||||
.is_verified(true)
|
.is_verified(true)
|
||||||
|
.email_verified(false)
|
||||||
.is_admin(true)
|
.is_admin(true)
|
||||||
.deleted(false)
|
.deleted(false)
|
||||||
.build()
|
.build()
|
||||||
|
@ -54,6 +55,7 @@ mod tests {
|
||||||
.hashed_password(username.into())
|
.hashed_password(username.into())
|
||||||
.is_verified(true)
|
.is_verified(true)
|
||||||
.is_admin(false)
|
.is_admin(false)
|
||||||
|
.email_verified(false)
|
||||||
.deleted(false)
|
.deleted(false)
|
||||||
.build()
|
.build()
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
|
|
|
@ -33,6 +33,7 @@ mod tests {
|
||||||
.email(username.into())
|
.email(username.into())
|
||||||
.hashed_password(username.into())
|
.hashed_password(username.into())
|
||||||
.is_verified(true)
|
.is_verified(true)
|
||||||
|
.email_verified(false)
|
||||||
.is_admin(true)
|
.is_admin(true)
|
||||||
.deleted(false)
|
.deleted(false)
|
||||||
.build()
|
.build()
|
||||||
|
|
|
@ -15,6 +15,7 @@ pub struct User {
|
||||||
hashed_password: String,
|
hashed_password: String,
|
||||||
is_verified: bool,
|
is_verified: bool,
|
||||||
is_admin: bool,
|
is_admin: bool,
|
||||||
|
email_verified: bool,
|
||||||
deleted: bool,
|
deleted: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,6 +27,7 @@ impl Default for User {
|
||||||
hashed_password: "".to_string(),
|
hashed_password: "".to_string(),
|
||||||
is_verified: false,
|
is_verified: false,
|
||||||
is_admin: false,
|
is_admin: false,
|
||||||
|
email_verified: false,
|
||||||
deleted: false,
|
deleted: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,6 +53,11 @@ impl User {
|
||||||
self
|
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 {
|
pub fn set_deleted(&mut self, deleted: bool) -> &mut Self {
|
||||||
self.deleted = deleted;
|
self.deleted = deleted;
|
||||||
self
|
self
|
||||||
|
@ -75,5 +82,8 @@ mod tests {
|
||||||
|
|
||||||
assert!(!u.deleted());
|
assert!(!u.deleted());
|
||||||
assert!(u.set_deleted(true).deleted());
|
assert!(u.set_deleted(true).deleted());
|
||||||
|
|
||||||
|
assert!(!u.email_verified());
|
||||||
|
assert!(u.set_email_verified(true).deleted());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue