452 return; |
452 return; |
453 } |
453 } |
454 |
454 |
455 if (lst[0] == "ASKPASSWORD") { |
455 if (lst[0] == "ASKPASSWORD") { |
456 int passLength = config->value("net/passwordlength", 0).toInt(); |
456 int passLength = config->value("net/passwordlength", 0).toInt(); |
457 QString hash = config->value("net/passwordhash", "").toString(); |
457 QString hash = config->value("net/passwordhash", "").toString(); |
458 QString password = QInputDialog::getText(0, tr("Password"), tr("Enter your password:"), QLineEdit::Password, passLength==0?NULL:QString(passLength,'\0')); |
458 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')); |
459 |
459 |
460 if (!passLength || password!=QString(passLength, '\0')) { |
460 if (!passLength || password!=QString(passLength, '\0')) { |
461 hash = QCryptographicHash::hash(password.toLatin1(), QCryptographicHash::Md5).toHex(); |
461 hash = QCryptographicHash::hash(password.toLatin1(), QCryptographicHash::Md5).toHex(); |
462 config->setValue("net/passwordhash", hash); |
462 config->setValue("net/passwordhash", hash); |
463 config->setValue("net/passwordlength", password.size()); |
463 config->setValue("net/passwordlength", password.size()); |