Skip to content

Commit 31aa4e2

Browse files
authoredJul 19, 2023
Merge pull request #53749 from Gustry/remove-password
Do not display the password in the dialog when requesting credentials
2 parents 155da0a + 3073450 commit 31aa4e2

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed
 

‎src/gui/qgscredentialdialog.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "qgscredentialdialog.h"
1919

2020
#include "qgsauthmanager.h"
21+
#include "qgsdatasourceuri.h"
2122
#include "qgslogger.h"
2223
#include "qgsapplication.h"
2324
#include "qgsgui.h"
@@ -92,7 +93,7 @@ QgsCredentialDialog::QgsCredentialDialog( QWidget *parent, Qt::WindowFlags fl )
9293
// Keep a cache of ignored connections, and ignore them for 10 seconds.
9394
connect( mIgnoreButton, &QPushButton::clicked, this, [ = ]( bool )
9495
{
95-
const QString realm { labelRealm->text() };
96+
const QString realm { mRealm };
9697
{
9798
const QMutexLocker locker( &sIgnoredConnectionsCacheMutex );
9899
// Insert the realm in the cache of ignored connections
@@ -148,7 +149,8 @@ void QgsCredentialDialog::requestCredentials( const QString &realm, QString *use
148149
stackedWidget->setCurrentIndex( 0 );
149150
mIgnoreButton->show();
150151
chkbxPasswordHelperEnable->setChecked( QgsApplication::authManager()->passwordHelperEnabled() );
151-
labelRealm->setText( realm );
152+
labelRealm->setText( QgsDataSourceUri::removePassword( realm ) );
153+
mRealm = realm;
152154
leUsername->setText( *username );
153155
lePassword->setText( *password );
154156
labelMessage->setText( message );

‎src/gui/qgscredentialdialog.h

+2
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ class GUI_EXPORT QgsCredentialDialog : public QDialog, public QgsCredentials, pr
7676
//! mutex for the static ignored connections cache
7777
static QMutex sIgnoredConnectionsCacheMutex;
7878

79+
QString mRealm;
80+
7981
ConnectionsIgnoreMode mIgnoreMode = ConnectionsIgnoreMode::IgnoreTemporarily;
8082

8183
};

0 commit comments

Comments
 (0)