28#include "moc_qgsauthmasterpassresetdialog.cpp"
30using namespace Qt::StringLiterals;
37 mAuthNotifyLayout =
new QVBoxLayout;
38 this->setLayout( mAuthNotifyLayout );
40 mAuthNotifyLayout->addWidget( mAuthNotify );
45 connect( leMasterPassCurrent, &QgsPasswordLineEdit::textChanged,
this, &QgsMasterPasswordResetDialog::validatePasswords );
46 connect( leMasterPassNew, &QgsPasswordLineEdit::textChanged,
this, &QgsMasterPasswordResetDialog::validatePasswords );
47 connect( leMasterPassNew2, &QgsPasswordLineEdit::textChanged,
this, &QgsMasterPasswordResetDialog::validatePasswords );
48 connect( buttonBox, &QDialogButtonBox::helpRequested,
this, [] {
54 chkKeepBackup->hide();
57 QString warning = tr(
"The authentication store will be re-encrypted using the new password." );
63 lblWarning->setText( warning );
69 return leMasterPassCurrent;
77 leMasterPassCurrent->setFocus();
79 const bool ok = ( exec() == QDialog::Accepted );
84 *newpass = leMasterPassNew->text();
85 *oldpass = leMasterPassCurrent->text();
86 *keepbackup = !chkKeepBackup->isHidden() && chkKeepBackup->isChecked();
93void QgsMasterPasswordResetDialog::validatePasswords()
95 const QString currentPassword = leMasterPassCurrent->text();
96 const QString newPassword = leMasterPassNew->text();
97 const QString confirmPassword = leMasterPassNew2->text();
99 const bool currentPasswordOk = !currentPassword.isEmpty();
100 const bool newPasswordOk = !newPassword.isEmpty();
101 const bool confirmPasswordOk = !confirmPassword.isEmpty() && confirmPassword == newPassword;
103 if ( leMasterPassCurrent->isEnabled() )
107 leMasterPassCurrent->setStyleSheet( ss1 );
110 : QgsAuthGuiUtils::redTextStyleSheet( u
"QLineEdit"_s );
111 leMasterPassNew->setStyleSheet( ss2 );
113 : QgsAuthGuiUtils::redTextStyleSheet( u
"QLineEdit"_s );
114 leMasterPassNew2->setStyleSheet( ss3 );
115 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).
static void openHelp(const QString &key)
Opens help topic for the given help key using default system web browser.
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 the entered password.