check for valid password at creation

master
rasul 5 years ago
parent db8e3cf1f7
commit f853002a90

@ -73,9 +73,21 @@ impl Game {
send_queue.push(token, "\n\nUsername: ", false, None);
client.state = State::Login(Login::Username);
} else {
send_queue.push(token, "\nNew password again: ", false, None);
client.state =
State::Login(Login::CreatePassword2((username.to_owned(), message)));
match self.check_player_password(message) {
PlayerCheck::Ok(pass) => {
send_queue.push(token, "\nNew password again: ", false, None);
client.state =
State::Login(Login::CreatePassword2((username.to_owned(), pass)));
},
PlayerCheck::Err(err) => {
send_queue.push(token, "\nInvalid password:\n", false, None);
for line in err {
send_queue.push(token, format!("{}\n", line), false, None);
}
send_queue.push(token, "\nNew password: ", false, None);
}
}
}
}

Loading…
Cancel
Save