Simplify password change call syntax
This commit is contained in:
@ -41,16 +41,13 @@ pub struct GetAllUsersRequest;
|
||||
pub struct GetAllUsersResult(pub Vec<User>);
|
||||
|
||||
#[derive(Message)]
|
||||
#[rtype(ChangePasswordResult)]
|
||||
#[rtype(result = "bool")]
|
||||
pub struct ChangePasswordRequest {
|
||||
pub user_id: UserID,
|
||||
pub new_password: String,
|
||||
pub temporary: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct ChangePasswordResult(pub bool);
|
||||
|
||||
#[derive(Message)]
|
||||
#[rtype(result = "bool")]
|
||||
pub struct AddSuccessful2FALogin(pub UserID, pub IpAddr);
|
||||
@ -109,14 +106,11 @@ impl Handler<LoginRequest> for UsersActor {
|
||||
}
|
||||
|
||||
impl Handler<ChangePasswordRequest> for UsersActor {
|
||||
type Result = MessageResult<ChangePasswordRequest>;
|
||||
type Result = <ChangePasswordRequest as actix::Message>::Result;
|
||||
|
||||
fn handle(&mut self, msg: ChangePasswordRequest, _ctx: &mut Self::Context) -> Self::Result {
|
||||
MessageResult(ChangePasswordResult(self.manager.change_user_password(
|
||||
&msg.user_id,
|
||||
&msg.new_password,
|
||||
msg.temporary,
|
||||
)))
|
||||
self.manager
|
||||
.change_user_password(&msg.user_id, &msg.new_password, msg.temporary)
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user