1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Fix bug with initial password dialogs accepting empty passwords

This commit is contained in:
Dubslow 2015-01-23 06:29:24 -06:00
parent dea2ccf0b7
commit 18e875ef20

View File

@ -1269,10 +1269,19 @@ QString Widget::passwordDialog(const QString& cancel, const QString& body)
dialog.setInputMode(QInputDialog::TextInput);
dialog.setTextEchoMode(QLineEdit::Password);
dialog.setLabelText(body);
int val = dialog.exec();
if (val == QDialog::Accepted)
ret = dialog.textValue();
return ret;
while (true)
{
int val = dialog.exec();
if (val != QDialog::Accepted)
return QString();
else
{
ret = dialog.textValue();
if (!ret.isEmpty())
return ret;
}
dialog.setLabelText(body + "\n" + tr("You must enter a non-empty password."));
}
}
}