mirror of
https://github.com/warp-tech/warpgate.git
synced 2025-09-08 15:44:25 +08:00
lint
This commit is contained in:
parent
b346ca3d0b
commit
6cace24fe8
7 changed files with 7 additions and 6 deletions
|
@ -49,7 +49,7 @@ impl ListApi {
|
||||||
|
|
||||||
if let Some(ref search) = *search {
|
if let Some(ref search) = *search {
|
||||||
let search = format!("%{search}%");
|
let search = format!("%{search}%");
|
||||||
roles = roles.filter(Role::Column::Name.like(&search));
|
roles = roles.filter(Role::Column::Name.like(search));
|
||||||
}
|
}
|
||||||
|
|
||||||
let roles = roles
|
let roles = roles
|
||||||
|
|
|
@ -51,7 +51,7 @@ impl ListApi {
|
||||||
|
|
||||||
if let Some(ref search) = *search {
|
if let Some(ref search) = *search {
|
||||||
let search = format!("%{search}%");
|
let search = format!("%{search}%");
|
||||||
targets = targets.filter(Target::Column::Name.like(&search));
|
targets = targets.filter(Target::Column::Name.like(search));
|
||||||
}
|
}
|
||||||
|
|
||||||
let targets = targets.all(&*db).await.map_err(WarpgateError::from)?;
|
let targets = targets.all(&*db).await.map_err(WarpgateError::from)?;
|
||||||
|
|
|
@ -54,7 +54,7 @@ impl ListApi {
|
||||||
|
|
||||||
if let Some(ref search) = *search {
|
if let Some(ref search) = *search {
|
||||||
let search = format!("%{search}%");
|
let search = format!("%{search}%");
|
||||||
users = users.filter(User::Column::Username.like(&search));
|
users = users.filter(User::Column::Username.like(search));
|
||||||
}
|
}
|
||||||
|
|
||||||
let users = users.all(&*db).await.map_err(WarpgateError::from)?;
|
let users = users.all(&*db).await.map_err(WarpgateError::from)?;
|
||||||
|
|
|
@ -10,7 +10,7 @@ use sea_orm::{ActiveModelTrait, ColumnTrait, DatabaseConnection, EntityTrait, Qu
|
||||||
use tokio::sync::Mutex;
|
use tokio::sync::Mutex;
|
||||||
use tracing::*;
|
use tracing::*;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
use warpgate_common::auth::{AuthCredential, CredentialPolicy, CredentialKind};
|
use warpgate_common::auth::{AuthCredential, CredentialKind, CredentialPolicy};
|
||||||
use warpgate_common::{Secret, Target, User, WarpgateError};
|
use warpgate_common::{Secret, Target, User, WarpgateError};
|
||||||
use warpgate_db_entities::Ticket;
|
use warpgate_db_entities::Ticket;
|
||||||
|
|
||||||
|
|
|
@ -143,7 +143,7 @@ impl Api {
|
||||||
|
|
||||||
let password_cred = AuthCredential::Password(Secret::new(body.password.clone()));
|
let password_cred = AuthCredential::Password(Secret::new(body.password.clone()));
|
||||||
if cp
|
if cp
|
||||||
.validate_credential(&state.username(), &password_cred)
|
.validate_credential(state.username(), &password_cred)
|
||||||
.await?
|
.await?
|
||||||
{
|
{
|
||||||
state.add_valid_credential(password_cred);
|
state.add_valid_credential(password_cred);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use http::{Method, StatusCode, Uri};
|
use http::{Method, StatusCode, Uri};
|
||||||
use poem::{FromRequest, Request};
|
|
||||||
use poem::web::Data;
|
use poem::web::Data;
|
||||||
|
use poem::{FromRequest, Request};
|
||||||
use tracing::*;
|
use tracing::*;
|
||||||
use warpgate_core::Services;
|
use warpgate_core::Services;
|
||||||
|
|
||||||
|
|
|
@ -213,6 +213,7 @@ fn copy_server_request<B: SomeRequestBuilder>(req: &Request, mut target: B) -> B
|
||||||
}
|
}
|
||||||
|
|
||||||
fn inject_forwarding_headers<B: SomeRequestBuilder>(req: &Request, mut target: B) -> Result<B> {
|
fn inject_forwarding_headers<B: SomeRequestBuilder>(req: &Request, mut target: B) -> Result<B> {
|
||||||
|
#[allow(clippy::unwrap_used)]
|
||||||
if let Some(host) = req.headers().get(http::header::HOST) {
|
if let Some(host) = req.headers().get(http::header::HOST) {
|
||||||
target = target.header(
|
target = target.header(
|
||||||
X_FORWARDED_HOST.clone(),
|
X_FORWARDED_HOST.clone(),
|
||||||
|
|
Loading…
Add table
Reference in a new issue