27#include "moc_qgsauthmasterpassresetdialog.cpp"
34 mAuthNotifyLayout =
new QVBoxLayout;
35 this->setLayout( mAuthNotifyLayout );
37 mAuthNotifyLayout->addWidget( mAuthNotify );
42 connect( leMasterPassCurrent, &QgsPasswordLineEdit::textChanged,
this, &QgsMasterPasswordResetDialog::validatePasswords );
43 connect( leMasterPassNew, &QgsPasswordLineEdit::textChanged,
this, &QgsMasterPasswordResetDialog::validatePasswords );
44 connect( leMasterPassNew2, &QgsPasswordLineEdit::textChanged,
this, &QgsMasterPasswordResetDialog::validatePasswords );
45 connect( buttonBox, &QDialogButtonBox::helpRequested,
this, [] {
46 QgsHelp::openHelp( QStringLiteral(
"auth_system/auth_overview.html#master-password" ) );
51 chkKeepBackup->hide();
54 QString warning = tr(
"The authentication store will be re-encrypted using the new password." );
60 lblWarning->setText( warning );
66 return leMasterPassCurrent;
74 leMasterPassCurrent->setFocus();
76 const bool ok = ( exec() == QDialog::Accepted );
81 *newpass = leMasterPassNew->text();
82 *oldpass = leMasterPassCurrent->text();
83 *keepbackup = !chkKeepBackup->isHidden() && chkKeepBackup->isChecked();
90void QgsMasterPasswordResetDialog::validatePasswords()
92 const QString currentPassword = leMasterPassCurrent->text();
93 const QString newPassword = leMasterPassNew->text();
94 const QString confirmPassword = leMasterPassNew2->text();
96 const bool currentPasswordOk = !currentPassword.isEmpty();
97 const bool newPasswordOk = !newPassword.isEmpty();
98 const bool confirmPasswordOk = !confirmPassword.isEmpty() && confirmPassword == newPassword;
100 if ( leMasterPassCurrent->isEnabled() )
104 leMasterPassCurrent->setStyleSheet( ss1 );
107 : QgsAuthGuiUtils::redTextStyleSheet( QStringLiteral(
"QLineEdit" ) );
108 leMasterPassNew->setStyleSheet( ss2 );
110 : QgsAuthGuiUtils::redTextStyleSheet( QStringLiteral(
"QLineEdit" ) );
111 leMasterPassNew2->setStyleSheet( ss3 );
112 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.