removed let banned and extra comments
This commit is contained in:
parent
c33f7ca830
commit
02947adc98
@ -60,10 +60,9 @@ pub fn get_login_status(entity_gateway: &dyn EntityGateway, pkt: &Login) -> Resu
|
|||||||
let username = array_to_utf8(pkt.username).map_err(|_err| AccountStatus::Error)?;
|
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 password = array_to_utf8(pkt.password).map_err(|_err| AccountStatus::Error)?;
|
||||||
let user = entity_gateway.get_user_by_name(username).ok_or(AccountStatus::InvalidUser)?;
|
let user = entity_gateway.get_user_by_name(username).ok_or(AccountStatus::InvalidUser)?;
|
||||||
let banned = user.banned;
|
|
||||||
let verified = bcrypt::verify(password, user.password.as_str()).map_err(|_err| AccountStatus::Error)?;
|
let verified = bcrypt::verify(password, user.password.as_str()).map_err(|_err| AccountStatus::Error)?;
|
||||||
match verified {
|
match verified {
|
||||||
true => if banned {
|
true => if user.banned {
|
||||||
Err(AccountStatus::Banned)
|
Err(AccountStatus::Banned)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -306,7 +305,7 @@ mod test {
|
|||||||
flags: 0,
|
flags: 0,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
} // end impl EntityGateway for TestData
|
}
|
||||||
|
|
||||||
let mut server = LoginServerState::new(TestData {});
|
let mut server = LoginServerState::new(TestData {});
|
||||||
let send = server.handle(ClientId(1), &LOGIN_PACKET).unwrap().collect::<Vec<_>>();
|
let send = server.handle(ClientId(1), &LOGIN_PACKET).unwrap().collect::<Vec<_>>();
|
||||||
@ -327,5 +326,5 @@ mod test {
|
|||||||
},
|
},
|
||||||
caps: 258
|
caps: 258
|
||||||
}))])
|
}))])
|
||||||
} // end test_banned_user()
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user