Start to create 2FA exemption after successful 2FA login
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2022-11-12 10:24:00 +01:00
parent c24318f6b8
commit 7a3eaa944e
7 changed files with 88 additions and 7 deletions

View File

@ -1,4 +1,5 @@
use actix::{Actor, Context, Handler, Message, MessageResult};
use std::net::IpAddr;
use crate::data::entity_manager::EntityManager;
use crate::data::user::{User, UserID};
@ -50,6 +51,10 @@ pub struct ChangePasswordRequest {
#[derive(Debug)]
pub struct ChangePasswordResult(pub bool);
#[derive(Message)]
#[rtype(result = "bool")]
pub struct AddSuccessful2FALogin(pub UserID, pub IpAddr);
#[derive(Debug)]
pub struct UpdateUserResult(pub bool);
@ -111,6 +116,15 @@ impl Handler<ChangePasswordRequest> for UsersActor {
}
}
impl Handler<AddSuccessful2FALogin> for UsersActor {
type Result = <AddSuccessful2FALogin as actix::Message>::Result;
fn handle(&mut self, msg: AddSuccessful2FALogin, _ctx: &mut Self::Context) -> Self::Result {
self.manager
.save_new_successful_2fa_authentication(&msg.0, msg.1)
}
}
impl Handler<GetUserRequest> for UsersActor {
type Result = MessageResult<GetUserRequest>;