mirror of
https://github.com/stoatchat/stoatchat.git
synced 2026-07-14 21:47:02 +00:00
fix: fix the issues caused by authifier migration
Signed-off-by: İspik <ispik@ispik.dev>
This commit is contained in:
@@ -2,16 +2,6 @@
|
||||
mod mongodb;
|
||||
mod reference;
|
||||
|
||||
use authifier::config::Captcha;
|
||||
use authifier::config::EmailVerificationConfig;
|
||||
use authifier::config::PasswordScanning;
|
||||
use authifier::config::ResolveIp;
|
||||
use authifier::config::SMTPSettings;
|
||||
use authifier::config::Shield;
|
||||
use authifier::config::Template;
|
||||
use authifier::config::Templates;
|
||||
use authifier::config::EmailExpiryConfig;
|
||||
use authifier::Authifier;
|
||||
use rand::Rng;
|
||||
use revolt_config::config;
|
||||
use revolt_result::Result;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use async_std::stream::StreamExt;
|
||||
use tokio_stream::StreamExt;
|
||||
use revolt_result::Result;
|
||||
|
||||
use crate::AdminAuditItem;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use async_std::stream::StreamExt;
|
||||
use tokio_stream::StreamExt;
|
||||
use bson::Document;
|
||||
use revolt_result::Result;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use iso8601_timestamp::Timestamp;
|
||||
use revolt_config::{capture_internal_error, report_error};
|
||||
use revolt_result::Result;
|
||||
use revolt_result::{Error, Result};
|
||||
use rocket::http::Status;
|
||||
use rocket::request::{self, FromRequest, Outcome, Request};
|
||||
|
||||
@@ -8,7 +8,7 @@ use crate::{AdminAuthorization, AdminMachineToken, AdminUser, Database};
|
||||
|
||||
#[rocket::async_trait]
|
||||
impl<'r> FromRequest<'r> for AdminMachineToken {
|
||||
type Error = authifier::Error;
|
||||
type Error = Error;
|
||||
|
||||
async fn from_request(request: &'r Request<'_>) -> request::Outcome<Self, Self::Error> {
|
||||
let user: &Option<AdminMachineToken> = request
|
||||
@@ -48,14 +48,14 @@ impl<'r> FromRequest<'r> for AdminMachineToken {
|
||||
if let Some(user) = user {
|
||||
Outcome::Success(user.clone())
|
||||
} else {
|
||||
Outcome::Error((Status::Unauthorized, authifier::Error::InvalidSession))
|
||||
Outcome::Error((Status::Unauthorized, create_error!(InvalidSession)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[rocket::async_trait]
|
||||
impl<'r> FromRequest<'r> for AdminAuthorization {
|
||||
type Error = authifier::Error;
|
||||
type Error = Error;
|
||||
|
||||
async fn from_request(request: &'r Request<'_>) -> request::Outcome<Self, Self::Error> {
|
||||
let machine: &Option<AdminMachineToken> = request
|
||||
@@ -94,7 +94,7 @@ impl<'r> FromRequest<'r> for AdminAuthorization {
|
||||
|
||||
if let Some(machine) = machine {
|
||||
if !machine.on_behalf_of.active {
|
||||
Outcome::Error((Status::Unauthorized, authifier::Error::LockedOut))
|
||||
Outcome::Error((Status::Unauthorized, create_error!(LockedOut)))
|
||||
} else {
|
||||
Outcome::Success(AdminAuthorization::AdminMachine(machine.clone()))
|
||||
}
|
||||
@@ -134,12 +134,12 @@ impl<'r> FromRequest<'r> for AdminAuthorization {
|
||||
|
||||
if let Some(user) = user {
|
||||
if !user.active {
|
||||
Outcome::Error((Status::Unauthorized, authifier::Error::LockedOut))
|
||||
Outcome::Error((Status::Unauthorized, create_error!(LockedOut)))
|
||||
} else {
|
||||
Outcome::Success(AdminAuthorization::AdminUser(user.clone()))
|
||||
}
|
||||
} else {
|
||||
Outcome::Error((Status::Unauthorized, authifier::Error::InvalidCredentials))
|
||||
Outcome::Error((Status::Unauthorized, create_error!(InvalidSession)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
use rocket::http::Status;
|
||||
use rocket::request::{self, FromRequest, Outcome, Request};
|
||||
|
||||
use revolt_result::Error;
|
||||
use crate::{AdminUser, Database};
|
||||
|
||||
#[rocket::async_trait]
|
||||
impl<'r> FromRequest<'r> for AdminUser {
|
||||
type Error = authifier::Error;
|
||||
type Error = Error;
|
||||
|
||||
async fn from_request(request: &'r Request<'_>) -> request::Outcome<Self, Self::Error> {
|
||||
let user: &Option<AdminUser> = request
|
||||
@@ -32,12 +32,12 @@ impl<'r> FromRequest<'r> for AdminUser {
|
||||
|
||||
if let Some(user) = user {
|
||||
if !user.active {
|
||||
Outcome::Error((Status::Unauthorized, authifier::Error::LockedOut))
|
||||
Outcome::Error((Status::Unauthorized, create_error!(LockedOut)))
|
||||
} else {
|
||||
Outcome::Success(user.clone())
|
||||
}
|
||||
} else {
|
||||
Outcome::Error((Status::Unauthorized, authifier::Error::InvalidCredentials))
|
||||
Outcome::Error((Status::Unauthorized, create_error!(InvalidCredentials)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user