Skip to content

Commit fba9982

Browse files
committed
[postgres][db2] username and authcfg are not mutually exclusive (followup aae7a32)
1 parent 761cdaf commit fba9982

File tree

2 files changed

+9
-15
lines changed

2 files changed

+9
-15
lines changed

src/providers/db2/qgsdb2dataitems.cpp

+9-9
Original file line numberDiff line numberDiff line change
@@ -84,18 +84,18 @@ bool QgsDb2ConnectionItem::ConnInfoFromParameters(
8484
{
8585
connInfo += "authcfg='" + authcfg + "' ";
8686
}
87-
else // include user and password if authcfg is empty
87+
88+
if ( !password.isEmpty() )
8889
{
89-
if ( !username.isEmpty() )
90-
{
91-
connInfo += "user='" + username + "' ";
92-
}
90+
// include password if authcfg is empty
91+
connInfo += "password='" + password + "' ";
92+
}
9393

94-
if ( !password.isEmpty() )
95-
{
96-
connInfo += "password='" + password + "' ";
97-
}
94+
if ( !username.isEmpty() )
95+
{
96+
connInfo += "user='" + username + "' ";
9897
}
98+
9999
QgsDebugMsg( "connInfo: '" + connInfo + "'" );
100100
return true;
101101
}

src/providers/postgres/qgspostgresconn.cpp

-6
Original file line numberDiff line numberDiff line change
@@ -1788,12 +1788,6 @@ QgsDataSourceUri QgsPostgresConn::connUri( const QString &connName )
17881788

17891789
QString authcfg = settings.value( key + "/authcfg" ).toString();
17901790

1791-
if ( !authcfg.isEmpty() )
1792-
{
1793-
username.clear();
1794-
password.clear();
1795-
}
1796-
17971791
QgsDataSourceUri uri;
17981792
if ( !service.isEmpty() )
17991793
{

0 commit comments

Comments
 (0)