[Qgis-developer] QGIS stores, in the QGIS project, users logins and passwords from PostGis

Jürgen E. Fischer jef at norbit.de
Mon Oct 22 23:41:27 PDT 2012


Hi J.

On Tue, 23. Oct 2012 at 08:00:55 +0200, J. Gaspar Mora Navarro wrote:
> I can't find how avoid QGIS stores users logins and passwords from  
> PostGis in the QGIS project.
>
> If I use this code:
>
>         uri = qgis.core.QgsDataSourceURI()
>         uri.setConnection(host, port, database, usuario, password)

Don't set username and password - otherwise they'll get saved.
But in that case QGIS will ask interactively for a the credentials via
QgsCredentials.  You might be able to avoid that using [1], before adding the
layers.


Jürgen 

[1] http://www.qgis.org/api/classQgsCredentials.html#a13e8e43c36c056e7ece146e985136658

-- 
Jürgen E. Fischer         norBIT GmbH               Tel. +49-4931-918175-31
Dipl.-Inf. (FH)           Rheinstraße 13            Fax. +49-4931-918175-50
Software Engineer         D-26506 Norden               http://www.norbit.de
committ(ed|ing) to Quantum GIS                         IRC: jef on FreeNode                         

-- 
norBIT Gesellschaft fuer Unternehmensberatung und Informationssysteme mbH
Rheinstrasse 13, 26506 Norden
GF: Jelto Buurman, HR: Amtsgericht Emden, HRB 5502



More information about the Qgis-developer mailing list