# eric4.Helpviewer.Passwords.PasswordManager

Module implementing the password manager.

### Global Attributes

None

### Classes

LoginForm | Class implementing a data structure for login forms.
PasswordManager | Class implementing the password manager.

### Functions

None

## LoginForm

Class implementing a data structure for login forms.

### Derived from

object

### Class Attributes

None

### Class Methods

None

### Methods

LoginForm | Constructor
isValid | Public method to test for validity.
load | Public method to load the form data from a file.
save | Public method to save the form data to a file.

### Static Methods

None

#### LoginForm (Constructor)

LoginForm()

Constructor

#### LoginForm.isValid

isValid()

Public method to test for validity.

Returns:
  flag indicating a valid form (boolean)

#### LoginForm.load

load(data)

Public method to load the form data from a file.

data
  list of strings to load data from (list of strings)

Returns:
  flag indicating success (boolean)

#### LoginForm.save

save(f)

Public method to save the form data to a file.

f
  file or file like object open for writing

Returns:
  flag indicating success (booelan)

Up

## PasswordManager

Class implementing the password manager.

### Signals

changed()
  emitted to indicate a change

### 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.
__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 open search engines manager.
fill | Public slot to fill login forms with saved data.
getLogin | Public method to get the login credentials.
post | Public method to check, if the data to be sent contains 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 or QString)

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 QString, QString)

#### 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.__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 (QStringList)

#### PasswordManager.clear

clear()

Public slot to clear the saved passwords.

#### PasswordManager.close

close()

Public method to close the open search engines manager.

#### PasswordManager.fill

fill(page)

Public slot to fill login forms with saved data.

page
  reference to the web page (QWebPage)

#### 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 or QString)

Returns:
  tuple containing the user name (string) and 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.removePassword

removePassword(site)

Public method to remove a password entry.

site
  web site name (string or QString)

#### 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 or QString)
username
  username for the login (string or QString)
password
  password for the login (string or QString)

#### PasswordManager.siteInfo

siteInfo(site)

Public method to get a reference to the named site.

site
  web site name (string or QString)

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