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