# eric6.Helpviewer.Passwords.PasswordManager

Module implementing the password manager.

### Global Attributes

None

### Classes

PasswordManager | Class implementing the password manager.

### Functions

None

## PasswordManager

Class implementing the password manager.

### Signals

changed()
  emitted to indicate a change
passwordsSaved()
  emitted after the passwords were saved

### Derived from

QObject

### Class Attributes

FORMS
NEVER
SEPARATOR

### Class Methods

None

### Methods

PasswordManager | Constructor
__createKey | Private method to create the key string for the login credentials.
__extractMultipartQueryItems | Private method to extract the query items for a post operation.
__findForm | Private method to find the form used for logging in.
__load | Private method to load the saved login credentials.
__loadNonXml | Private method to load non-XML password files.
__stripUrl | Private method to strip off all unneeded parts of a URL.
allSiteNames | Public method to get a list of all site names.
clear | Public slot to clear the saved passwords.
close | Public method to close the passwords manager.
fill | Public slot to fill login forms with saved data.
getFileName | Public method to get the file name of the passwords file.
getLogin | Public method to get the login credentials.
masterPasswordChanged | Public slot to handle the change of the master password.
post | Public method to check, if the data to be sent contains login data.
reload | Public method to reload the login data.
removePassword | Public method to remove a password entry.
save | Public slot to save the login entries to disk.
setLogin | Public method to set the login credentials.
siteInfo | Public method to get a reference to the named site.
sitesCount | Public method to get the number of available sites.

### Static Methods

None

#### PasswordManager (Constructor)

PasswordManager(parent=None)

Constructor

parent
  reference to the parent object (QObject)

#### PasswordManager.__createKey

__createKey(url, realm)

Private method to create the key string for the login credentials.

url
  URL to get the credentials for (QUrl)
realm
  realm to get the credentials for (string)

Returns:
  key string (string)

#### PasswordManager.__extractMultipartQueryItems

__extractMultipartQueryItems(data, boundary)

Private method to extract the query items for a post operation.

data
  data to be sent (QByteArray)
boundary
  boundary string (QByteArray)

Returns:
  set of name, value pairs (set of tuple of string, string)

#### PasswordManager.__findForm

__findForm(webPage, data, boundary=None)

Private method to find the form used for logging in.

webPage
  reference to the web page (QWebPage)
data
  data to be sent (QByteArray)
boundary=
  boundary string (QByteArray) for multipart encoded data, None for urlencoded data

Returns:
  parsed form (LoginForm)

#### PasswordManager.__load

__load()

Private method to load the saved login credentials.

#### PasswordManager.__loadNonXml

__loadNonXml(loginFile)

Private method to load non-XML password files.

This method is to convert from the old, non-XML format to the new XML based format.

loginFile
  name of the non-XML password file (string)

#### PasswordManager.__stripUrl

__stripUrl(url)

Private method to strip off all unneeded parts of a URL.

url
  URL to be stripped (QUrl)

Returns:
  stripped URL (QUrl)

#### PasswordManager.allSiteNames

allSiteNames()

Public method to get a list of all site names.

Returns:
  sorted list of all site names (list of strings)

#### PasswordManager.clear

clear()

Public slot to clear the saved passwords.

#### PasswordManager.close

close()

Public method to close the passwords manager.

#### PasswordManager.fill

fill(page)

Public slot to fill login forms with saved data.

page
  reference to the web page (QWebPage)

#### PasswordManager.getFileName

getFileName()

Public method to get the file name of the passwords file.

Returns:
  name of the passwords file (string)

#### PasswordManager.getLogin

getLogin(url, realm)

Public method to get the login credentials.

url
  URL to get the credentials for (QUrl)
realm
  realm to get the credentials for (string)

Returns:
  tuple containing the user name (string) and password (string)

#### PasswordManager.masterPasswordChanged

masterPasswordChanged(oldPassword, newPassword)

Public slot to handle the change of the master password.

oldPassword
  current master password (string)
newPassword
  new master password (string)

#### PasswordManager.post

post(request, data)

Public method to check, if the data to be sent contains login data.

request
  reference to the network request (QNetworkRequest)
data
  data to be sent (QByteArray)

#### PasswordManager.reload

reload()

Public method to reload the login data.

#### PasswordManager.removePassword

removePassword(site)

Public method to remove a password entry.

site
  web site name (string)

#### PasswordManager.save

save()

Public slot to save the login entries to disk.

#### PasswordManager.setLogin

setLogin(url, realm, username, password)

Public method to set the login credentials.

url
  URL to set the credentials for (QUrl)
realm
  realm to set the credentials for (string)
username
  username for the login (string)
password
  password for the login (string)

#### PasswordManager.siteInfo

siteInfo(site)

Public method to get a reference to the named site.

site
  web site name (string)

Returns:
  tuple containing the user name (string) and password (string)

#### PasswordManager.sitesCount

sitesCount()

Public method to get the number of available sites.

Returns:
  number of sites (integer)

Up