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