diff --git a/src/gui/PasswordGeneratorWidget.cpp b/src/gui/PasswordGeneratorWidget.cpp index 6495d83a2..d61528f9f 100644 --- a/src/gui/PasswordGeneratorWidget.cpp +++ b/src/gui/PasswordGeneratorWidget.cpp @@ -132,8 +132,10 @@ void PasswordGeneratorWidget::updatePasswordStrength(const QString& password) void PasswordGeneratorWidget::generatePassword() { - QString password = m_generator->generatePassword(); - m_ui->editNewPassword->setText(password); + if (m_generator->isValid()) { + QString password = m_generator->generatePassword(); + m_ui->editNewPassword->setText(password); + } } void PasswordGeneratorWidget::applyPassword() @@ -279,5 +281,12 @@ void PasswordGeneratorWidget::updateGenerator() m_generator->setCharClasses(classes); m_generator->setFlags(flags); + if (m_generator->isValid()) { + m_ui->buttonGenerate->setEnabled(true); + } + else { + m_ui->buttonGenerate->setEnabled(false); + } + regeneratePassword(); }