Translate authentication errors
This commit is contained in:
parent
7ec4cc7c2e
commit
c4364d5d67
@ -7,6 +7,8 @@ pub struct AuthenticationConfig {
|
|||||||
/// Whether to use Mojang authentication.
|
/// Whether to use Mojang authentication.
|
||||||
pub enabled: bool,
|
pub enabled: bool,
|
||||||
pub auth_url: Option<String>,
|
pub auth_url: Option<String>,
|
||||||
|
pub connect_timeout: u32,
|
||||||
|
pub read_timeout: u32,
|
||||||
pub prevent_proxy_connections: bool,
|
pub prevent_proxy_connections: bool,
|
||||||
pub prevent_proxy_connection_auth_url: Option<String>,
|
pub prevent_proxy_connection_auth_url: Option<String>,
|
||||||
/// Player profile handling.
|
/// Player profile handling.
|
||||||
@ -24,6 +26,8 @@ impl Default for AuthenticationConfig {
|
|||||||
textures: Default::default(),
|
textures: Default::default(),
|
||||||
auth_url: None,
|
auth_url: None,
|
||||||
prevent_proxy_connection_auth_url: None,
|
prevent_proxy_connection_auth_url: None,
|
||||||
|
connect_timeout: 5000,
|
||||||
|
read_timeout: 5000,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -187,9 +187,18 @@ impl Client {
|
|||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
Ok(new_profile) => *profile = new_profile,
|
Ok(new_profile) => *profile = new_profile,
|
||||||
Err(e) => {
|
Err(error) => {
|
||||||
self.kick(&TextComponent::text(e.to_string())).await;
|
self.kick(&match error {
|
||||||
return;
|
AuthError::FailedResponse => {
|
||||||
|
TextComponent::translate("multiplayer.disconnect.authservers_down", [])
|
||||||
|
}
|
||||||
|
AuthError::UnverifiedUsername => TextComponent::translate(
|
||||||
|
"multiplayer.disconnect.unverified_username",
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
e => TextComponent::text(e.to_string()),
|
||||||
|
})
|
||||||
|
.await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,8 @@
|
|||||||
use connection_cache::{CachedBranding, CachedStatus};
|
use connection_cache::{CachedBranding, CachedStatus};
|
||||||
use crossbeam::atomic::AtomicCell;
|
use crossbeam::atomic::AtomicCell;
|
||||||
|
use hmac::digest::consts::U6;
|
||||||
use key_store::KeyStore;
|
use key_store::KeyStore;
|
||||||
use pumpkin_config::BASIC_CONFIG;
|
use pumpkin_config::{ADVANCED_CONFIG, BASIC_CONFIG};
|
||||||
use pumpkin_data::entity::EntityType;
|
use pumpkin_data::entity::EntityType;
|
||||||
use pumpkin_inventory::drag_handler::DragHandler;
|
use pumpkin_inventory::drag_handler::DragHandler;
|
||||||
use pumpkin_inventory::{Container, OpenContainer};
|
use pumpkin_inventory::{Container, OpenContainer};
|
||||||
@ -88,7 +89,12 @@ impl Server {
|
|||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
let auth_client = BASIC_CONFIG.online_mode.then(|| {
|
let auth_client = BASIC_CONFIG.online_mode.then(|| {
|
||||||
reqwest::Client::builder()
|
reqwest::Client::builder()
|
||||||
.timeout(Duration::from_millis(5000))
|
.connect_timeout(Duration::from_millis(
|
||||||
|
ADVANCED_CONFIG.networking.authentication.connect_timeout as u64,
|
||||||
|
))
|
||||||
|
.read_timeout(Duration::from_millis(
|
||||||
|
ADVANCED_CONFIG.networking.authentication.read_timeout as u64,
|
||||||
|
))
|
||||||
.build()
|
.build()
|
||||||
.expect("Failed to to make reqwest client")
|
.expect("Failed to to make reqwest client")
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user