Two factor authentication : TOTP #5

Merged
pierre merged 22 commits from twofactors into master 2022-04-20 07:40:51 +00:00
Showing only changes of commit deb00c572d - Show all commits

View File

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