Two factor authentication : TOTP #5
@ -6,6 +6,7 @@ use actix::Addr;
|
||||
use actix_identity::Identity;
|
||||
use actix_web::{Error, FromRequest, HttpRequest, web};
|
||||
use actix_web::dev::Payload;
|
||||
use actix_web::error::ErrorInternalServerError;
|
||||
|
||||
use crate::actors::users_actor;
|
||||
use crate::actors::users_actor::UsersActor;
|
||||
@ -41,9 +42,14 @@ impl FromRequest for CurrentUser {
|
||||
|
||||
|
||||
Box::pin(async move {
|
||||
let user: User = user_actor.send(
|
||||
let user = match user_actor.send(
|
||||
users_actor::GetUserRequest(user_id)
|
||||
).await.unwrap().0.unwrap();
|
||||
).await.unwrap().0 {
|
||||
Some(u) => u,
|
||||
None => {
|
||||
return Err(ErrorInternalServerError("Could not extract user information!"));
|
||||
}
|
||||
};
|
||||
|
||||
Ok(CurrentUser(user))
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user