|
|
@ -58,15 +58,15 @@ impl SendServerPacket for SendLoginPacket { |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pub async fn get_login_status(entity_gateway: &impl EntityGateway, pkt: &Login) -> Result<UserAccountEntity, AccountStatus> {
|
|
|
|
let username = array_to_utf8(pkt.username).map_err(|_err| AccountStatus::Error)?;
|
|
|
|
let password = array_to_utf8(pkt.password).map_err(|_err| AccountStatus::Error)?;
|
|
|
|
let user = entity_gateway.get_user_by_name(username).await.map_err(|_| AccountStatus::InvalidUser)?;
|
|
|
|
if user.is_currently_online() {
|
|
|
|
/*if user.is_currently_online() {
|
|
|
|
return Err(AccountStatus::AlreadyOnline)
|
|
|
|
}
|
|
|
|
}*/
|
|
|
|
|
|
|
|
log::info!("user: {}, activated {}", user.username, user.activated);
|
|
|
|
if !user.activated {
|
|
|
|
return Err(AccountStatus::PayUp)
|
|
|
|
}
|
|
|
@ -84,12 +84,15 @@ pub async fn get_login_status(entity_gateway: &impl EntityGateway, pkt: &Login) |
|
|
|
}
|
|
|
|
|
|
|
|
pub fn check_if_already_online(user: UserAccountEntity) -> Result<UserAccountEntity, AccountStatus> {
|
|
|
|
Ok(user)
|
|
|
|
/*
|
|
|
|
if user.is_currently_online() {
|
|
|
|
Err(AccountStatus::PayUp)
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
Ok(user)
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
|
|
|
|
pub struct LoginServerState<EG: EntityGateway> {
|
|
|
|