chore: fix http mode and admin signup init
This commit is contained in:
parent
20f5e00cba
commit
5ee4a522d4
@ -78,7 +78,7 @@ pub fn admin_router_handlers() -> Router {
|
||||
let _ = req_handler.trace_req(format!("Render users list"));
|
||||
(
|
||||
res_headers,
|
||||
result.to_owned()
|
||||
result
|
||||
).into_response()
|
||||
}
|
||||
async fn user_get_handler(
|
||||
|
@ -2,9 +2,7 @@ use std::sync::Arc;
|
||||
use casbin::CoreApi;
|
||||
use axum::{
|
||||
extract::{Request,ConnectInfo},
|
||||
http::{
|
||||
StatusCode,
|
||||
},
|
||||
http::StatusCode,
|
||||
Extension,
|
||||
response::{IntoResponse,Response,Redirect},
|
||||
middleware::Next,
|
||||
|
@ -370,7 +370,12 @@ pub fn users_router_handlers() -> Router {
|
||||
} else {
|
||||
DEFAULT_ROLES.to_owned()
|
||||
};
|
||||
let isadmin = if user_data.id == "A" {
|
||||
let total_users = User::count(&app_dbs.user_store).await.unwrap_or_else(|e|{
|
||||
let _ = req_handler.trace_req( format!("Users count error: {}",e));
|
||||
println!("Count error: {}",e);
|
||||
-1
|
||||
});
|
||||
let isadmin = if user_data.id == "A" || total_users < 1 {
|
||||
true
|
||||
} else {
|
||||
false
|
||||
@ -600,10 +605,18 @@ pub fn users_router_handlers() -> Router {
|
||||
"post_login_handler"
|
||||
);
|
||||
let _ = req_handler.trace_req(format!("user '{}', new token: '{}', cookie: '{}' ",&user_login.name, &session_token, &session_cookie));
|
||||
(
|
||||
req_handler.req_header.header,
|
||||
result
|
||||
).into_response()
|
||||
// TODO Is this a bug ??
|
||||
// http -> tokio-runtime-worker' panicked at 'payload claims content-length of 10, custom content-length header claims 34
|
||||
if app_dbs.config.protocol == "https" {
|
||||
(
|
||||
req_handler.req_header.header,
|
||||
result
|
||||
).into_response()
|
||||
} else {
|
||||
(
|
||||
result
|
||||
).into_response()
|
||||
}
|
||||
},
|
||||
Err(e) => {
|
||||
let _ = req_handler.trace_req(format!("user '{}' update error: {}",&user_login.name,e));
|
||||
|
Loading…
Reference in New Issue
Block a user