# HG changeset patch # User sheepluva # Date 1270165048 0 # Node ID ab99a0f0b485f2fb8c27686f419d5af9d5985f7d # Parent 252be02536ab4b1da69c3f5264e99ff598f1f183 * fixing bug #156: Cancel button on password request works now. diff -r 252be02536ab -r ab99a0f0b485 QTfrontend/newnetclient.cpp --- 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);