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:
parent
dea2ccf0b7
commit
18e875ef20
|
@ -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."));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user