wesnothd: Do not allow users with inactive accounts...

...to claim ownership of their names (treat as unregistered)

Clients attempting to use inactive accounts will get a warning message
informing them of the situation but will be able to join the MP server
as if their nickname were unregistered instead. Untested.
This commit is contained in:
Ignacio R. Morelle 2011-06-24 08:47:48 +00:00
parent bf906de800
commit 789ac43a2f
2 changed files with 9 additions and 1 deletions

View file

@ -27,6 +27,7 @@
#define MP_NAME_TOO_LONG_ERROR "103"
#define MP_NAME_RESERVED_ERROR "104"
#define MP_NAME_UNREGISTERED_ERROR "105"
#define MP_NAME_INACTIVE_WARNING "106"
#define MP_PASSWORD_REQUEST "200"
#define MP_PASSWORD_REQUEST_FOR_LOGGED_IN_NAME "201"

View file

@ -1086,7 +1086,14 @@ void server::process_login(const network::connection sock,
bool registered = false;
if(user_handler_) {
std::string password = (*login)["password"].to_string();
if(user_handler_->user_exists(username)) {
const bool exists = user_handler_->user_exists(username);
// This name is registered but the account is not active
if(exists && !user_handler_->user_is_active(username)) {
send_warning(sock, "The nick '" + username + "' is inactive. You cannot claim ownership of this "
"name until you activate your account via email or ask an administrator to do it for you.", MP_NAME_INACTIVE_WARNING);
//registered = false;
}
else if(exists) {
// This name is registered and no password provided
if(password.empty()) {
if(p == players_.end()) {