QTfrontend/newnetclient.cpp
changeset 3246 ab99a0f0b485
parent 3236 4ab3917d7d44
child 3283 18ee933a5864
--- a/QTfrontend/newnetclient.cpp	Thu Apr 01 21:57:03 2010 +0000
+++ b/QTfrontend/newnetclient.cpp	Thu Apr 01 23:37:28 2010 +0000
@@ -453,10 +453,17 @@
     }
 
     if (lst[0] == "ASKPASSWORD") {
+        bool ok = false;
         int passLength = config->value("net/passwordlength", 0).toInt();
         QString hash = config->value("net/passwordhash", "").toString();
-        QString password = QInputDialog::getText(0, tr("Password"), tr("Your nickname %1 is\nregistered on Hedgewars.org\nPlease provide your password\nor pick another nickname:").arg(mynick), QLineEdit::Password, passLength==0?NULL:QString(passLength,'\0'));
-
+        QString password = QInputDialog::getText(0, tr("Password"), tr("Your nickname %1 is\nregistered on Hedgewars.org\nPlease provide your password\nor pick another nickname:").arg(mynick), QLineEdit::Password, passLength==0?NULL:QString(passLength,'\0'), &ok);
+        
+        if (!ok) {
+            Disconnect();
+            emit Disconnected();
+            return;
+        }
+        
         if (!passLength || password!=QString(passLength, '\0')) {
             hash = QCryptographicHash::hash(password.toLatin1(), QCryptographicHash::Md5).toHex();
             config->setValue("net/passwordhash", hash);