master
rasul 5 years ago
parent b9156b0300
commit 6c0eb7a57d

@ -25,7 +25,10 @@ impl Game {
for c in name.chars() { for c in name.chars() {
if !self.config.player.name_chars.contains(&c.to_string()) { if !self.config.player.name_chars.contains(&c.to_string()) {
err_vec.push(format!("Allowed characters are: {}", self.config.player.name_chars)); err_vec.push(format!(
"Allowed characters are: {}",
self.config.player.name_chars
));
break; break;
} }
} }
@ -50,7 +53,10 @@ impl Game {
for c in password.chars() { for c in password.chars() {
if !self.config.player.pass_chars.contains(&c.to_string()) { if !self.config.player.pass_chars.contains(&c.to_string()) {
err_vec.push(format!("Allowed characters are: {}", self.config.player.pass_chars)); err_vec.push(format!(
"Allowed characters are: {}",
self.config.player.pass_chars
));
break; break;
} }
} }

@ -27,8 +27,7 @@ impl Game {
send_queue.push(token, "\n\nUsername: ", false, None); send_queue.push(token, "\n\nUsername: ", false, None);
} else { } else {
match self.check_player_name(message) { match self.check_player_name(message) {
PlayerCheck::Ok(name) => { PlayerCheck::Ok(name) => match self.db.find_player_by_name(&name) {
match self.db.find_player_by_name(&name) {
Ok(Some(_)) => { Ok(Some(_)) => {
send_queue.push(token, "\nPassword: ", false, None); send_queue.push(token, "\nPassword: ", false, None);
client.state = State::Login(Login::Password(name)); client.state = State::Login(Login::Password(name));
@ -45,7 +44,6 @@ impl Game {
Err(_) => { Err(_) => {
send_queue.push(token, "\nError\n\nUsername: ", false, None); send_queue.push(token, "\nError\n\nUsername: ", false, None);
} }
}
}, },
PlayerCheck::Err(err) => { PlayerCheck::Err(err) => {
send_queue.push(token, "\nInvalid username:\n", false, None); send_queue.push(token, "\nInvalid username:\n", false, None);
@ -53,7 +51,7 @@ impl Game {
send_queue.push(token, format!("{}\n", line), false, None); send_queue.push(token, format!("{}\n", line), false, None);
} }
send_queue.push(token, "\n\nUsername: ", false, None); send_queue.push(token, "\n\nUsername: ", false, None);
}, }
}; };
} }
} }

Loading…
Cancel
Save