Make usage of FatalErrorPage
more convenient
This commit is contained in:
@ -11,10 +11,9 @@ use actix_web::{
|
||||
};
|
||||
use actix_web::body::EitherBody;
|
||||
use actix_web::http::{header, Method};
|
||||
use askama::Template;
|
||||
|
||||
use crate::constants::{ADMIN_ROUTES, AUTHENTICATED_ROUTES, AUTHORIZE_URI, TOKEN_URI, USERINFO_URI};
|
||||
use crate::controllers::base_controller::{FatalErrorPage, redirect_user_for_login};
|
||||
use crate::controllers::base_controller::{build_fatal_error_page, redirect_user_for_login};
|
||||
use crate::data::app_config::AppConfig;
|
||||
use crate::data::session_identity::{SessionIdentity, SessionIdentityData, SessionStatus};
|
||||
|
||||
@ -143,10 +142,8 @@ impl<S, B> Service<ServiceRequest> for AuthInnerMiddleware<S>
|
||||
if !session.is_admin() && req.path().starts_with(ADMIN_ROUTES) {
|
||||
return Ok(req
|
||||
.into_response(
|
||||
HttpResponse::Unauthorized()
|
||||
.body(FatalErrorPage {
|
||||
message: "You are not allowed to access this resource."
|
||||
}.render().unwrap()),
|
||||
HttpResponse::Unauthorized().body(
|
||||
build_fatal_error_page("You are not allowed to access this resource.")),
|
||||
)
|
||||
.map_into_right_body());
|
||||
}
|
||||
|
Reference in New Issue
Block a user