18#include "moc_qgsauthmasterpassresetdialog.cpp"
33 mAuthNotifyLayout =
new QVBoxLayout;
34 this->setLayout( mAuthNotifyLayout );
36 mAuthNotifyLayout->addWidget( mAuthNotify );
41 connect( leMasterPassCurrent, &QgsPasswordLineEdit::textChanged,
this, &QgsMasterPasswordResetDialog::validatePasswords );
42 connect( leMasterPassNew, &QgsPasswordLineEdit::textChanged,
this, &QgsMasterPasswordResetDialog::validatePasswords );
43 connect( leMasterPassNew2, &QgsPasswordLineEdit::textChanged,
this, &QgsMasterPasswordResetDialog::validatePasswords );
47 chkKeepBackup->hide();
50 QString warning = tr(
"The authentication store will be re-encrypted using the new password." );
56 lblWarning->setText( warning );
62 return leMasterPassCurrent;
70 leMasterPassCurrent->setFocus();
72 const bool ok = ( exec() == QDialog::Accepted );
77 *newpass = leMasterPassNew->text();
78 *oldpass = leMasterPassCurrent->text();
79 *keepbackup = !chkKeepBackup->isHidden() && chkKeepBackup->isChecked();
86void QgsMasterPasswordResetDialog::validatePasswords()
88 const QString currentPassword = leMasterPassCurrent->text();
89 const QString newPassword = leMasterPassNew->text();
90 const QString confirmPassword = leMasterPassNew2->text();
92 const bool currentPasswordOk = !currentPassword.isEmpty();
93 const bool newPasswordOk = !newPassword.isEmpty();
94 const bool confirmPasswordOk = !confirmPassword.isEmpty() && confirmPassword == newPassword;
96 if ( leMasterPassCurrent->isEnabled() )
100 leMasterPassCurrent->setStyleSheet( ss1 );
104 leMasterPassNew->setStyleSheet( ss2 );
107 leMasterPassNew2->setStyleSheet( ss3 );
108 buttonBox->button( QDialogButtonBox::Ok )->setEnabled( currentPasswordOk && newPasswordOk && confirmPasswordOk );
static QgsAuthManager * authManager()
Returns the application's authentication manager instance.
Utility functions for use by authentication GUI widgets or standalone apps.
static QString greenTextStyleSheet(const QString &selector="*")
Green text stylesheet representing valid, trusted, etc. certificate.
static QString passwordHelperDisplayName(bool titleCase=false)
Returns a translated display name of the password helper (platform dependent).
QgsMasterPasswordResetDialog(QWidget *parent=nullptr)
bool requestMasterPasswordReset(QString *newpass, QString *oldpass, bool *keepbackup)
QgsPasswordLineEdit * oldPasswordLineEdit()
Returns the old password line edit widget.
QLineEdit subclass with built in support for showing/hiding entered password.