mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
remove authc from common::net
This commit is contained in:
parent
5862920f32
commit
425063e24e
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -5524,7 +5524,6 @@ dependencies = [
|
||||
name = "veloren-common-net"
|
||||
version = "0.9.0"
|
||||
dependencies = [
|
||||
"authc",
|
||||
"hashbrown",
|
||||
"serde",
|
||||
"specs",
|
||||
|
@ -21,9 +21,6 @@ tracing = { version = "0.1", default-features = false }
|
||||
# Data structures
|
||||
hashbrown = { version = "0.9", features = ["rayon", "serde", "nightly"] }
|
||||
|
||||
# Auth
|
||||
authc = { git = "https://gitlab.com/veloren/auth.git", rev = "fb3dcbc4962b367253f8f2f92760ef44d2679c9a" }
|
||||
|
||||
# ECS
|
||||
specs = { git = "https://github.com/amethyst/specs.git", features = ["serde", "storage-event-control"], rev = "5a9b71035007be0e3574f35184acac1cd4530496" }
|
||||
specs-idvs = { git = "https://gitlab.com/veloren/specs-idvs.git", rev = "b65fb220e94f5d3c9bc30074a076149763795556" }
|
||||
|
@ -1,6 +1,5 @@
|
||||
use super::{world_msg::EconomyInfo, ClientType, EcsCompPacket, PingMsg};
|
||||
use crate::sync;
|
||||
use authc::AuthClientError;
|
||||
use common::{
|
||||
character::{self, CharacterItem},
|
||||
comp::{self, invite::InviteKind, item::MaterialStatManifest},
|
||||
@ -259,10 +258,6 @@ impl ServerMsg {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<AuthClientError> for RegisterError {
|
||||
fn from(err: AuthClientError) -> Self { Self::AuthError(err.to_string()) }
|
||||
}
|
||||
|
||||
impl From<comp::ChatMsg> for ServerGeneral {
|
||||
fn from(v: comp::ChatMsg) -> Self { ServerGeneral::ChatMsg(v) }
|
||||
}
|
||||
|
@ -167,9 +167,17 @@ impl LoginProvider {
|
||||
let token = AuthToken::from_str(username_or_token)
|
||||
.map_err(|e| RegisterError::AuthError(e.to_string()))?;
|
||||
// Validate token
|
||||
let uuid = srv.validate(token).await?;
|
||||
let username = srv.uuid_to_username(uuid).await?;
|
||||
Ok((username, uuid))
|
||||
match async {
|
||||
let uuid = srv.validate(token).await?;
|
||||
let username = srv.uuid_to_username(uuid).await?;
|
||||
let r: Result<_, authc::AuthClientError> = Ok((username, uuid));
|
||||
r
|
||||
}
|
||||
.await
|
||||
{
|
||||
Err(e) => Err(RegisterError::AuthError(e.to_string())),
|
||||
Ok((username, uuid)) => Ok((username, uuid)),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn username_to_uuid(&self, username: &str) -> Result<Uuid, AuthClientError> {
|
||||
|
Loading…
Reference in New Issue
Block a user