WARNING: Most of this content (with the exception of the Mozilla 1.9 XPCOM reference) is very old, and can be expected to be out of date and possibly obsolete. For better XUL documentation, please visit the XUL hub at the Mozilla Developer Center.

nsILoginManager

IID:579f45b7-682f-479f-9085-3f8075488803
Inherits From:nsISupports

This interface is implemented by the following components:


Methods

void addLogin ( nsILoginInfo login ) nsIAutoCompleteResult autoCompleteSearch ( AString searchString , nsIAutoCompleteResult previousResult , nsIDOMHTMLInputElement element ) PRUint32 countLogins ( AString hostname , AString actionURL , AString httpRealm ) void findLogins ( out PRUint32 count , AString hostname , AString actionURL , AString httpRealm , out nsILoginInfo logins ) void getAllDisabledHosts ( out PRUint32 count , out arrayof PRUnichar* hostnames ) void getAllLogins ( out PRUint32 count , out nsILoginInfo logins ) PRBool getLoginSavingEnabled ( AString host ) void modifyLogin ( nsILoginInfo oldLogin , nsILoginInfo newLogin ) void removeAllLogins ( ) void removeLogin ( nsILoginInfo login ) void setLoginSavingEnabled ( AString host , PRBool isEnabled )

void addLogin ( nsILoginInfo login )

Store a new login in the login manager.

Arguments:
login: The login to be added.

nsIAutoCompleteResult autoCompleteSearch ( AString searchString , nsIAutoCompleteResult previousResult , nsIDOMHTMLInputElement element )

Generate results for a userfield autocomplete menu.

NOTE: This interface is provided for use only by the FormFillController, which calls it directly. This isn't really ideal, it should probably be callback registered through the FFC.

Arguments:
searchString
previousResult
element

PRUint32 countLogins ( AString hostname , AString actionURL , AString httpRealm )

Search for logins matching the specified criteria, as with findLogins(). This interface only returns the number of matching logins (and not the logins themselves), which allows a caller to check for logins without causing the user to be prompted for a master password to decrypt the logins.

Arguments:
hostname: The hostname to restrict searches to. Specify an empty string to match all hosts. A null value will not match any logins, and will thus always return a count of 0.
actionURL: The URL to which a form login will be submitted. To match any form login, specify an empty string. To not match any form login, specify null.
httpRealm: The HTTP Realm for which the login applies. To match logins for any realm, specify an empty string. To not match logins for any realm, specify null.

void findLogins ( out PRUint32 count , AString hostname , AString actionURL , AString httpRealm , out nsILoginInfo logins )

Search for logins matching the specified criteria. Called when looking for logins that might be applicable to a form or authentication request.

NOTE: This can be called from JS as: var logins = pwmgr.findLogins({}, hostname, ...);

Arguments:
count: The number of elements in the array. JS callers can simply use the array's .length property, and supply an dummy object for this out param. For example: |findLogins({}, hostname, ...)|
hostname: The hostname to restrict searches to, in URL format. For example: "http://www.site.com".
actionURL: For form logins, this argument should be the URL to which the form will be submitted. For protocol logins, specify null.
httpRealm: For protocol logins, this argument should be the HTTP Realm for which the login applies. This is obtained from the WWW-Authenticate header. See RFC2617. For form logins, specify null.
logins: An array of nsILoginInfo objects.

void getAllDisabledHosts ( out PRUint32 count , out arrayof PRUnichar* hostnames )

Obtain a list of all hosts for which password saving is disabled.

NOTE: This can be called from JS as: var logins = pwmgr.getDisabledAllLogins({});

Arguments:
count: The number of elements in the array. JS callers can simply use the array's .length property, and supply an dummy object for this out param. For example: |getAllDisabledHosts({})|
hostnames: An array of hostname strings, in origin URL format without a pathname. For example: "https://www.site.com".

void getAllLogins ( out PRUint32 count , out nsILoginInfo logins )

Fetch all logins in the login manager. An array is always returned; if there are no logins the array is empty.

NOTE: This can be called from JS as: var logins = pwmgr.getAllLogins({}); (logins is an array).

Arguments:
count: The number of elements in the array. JS callers can simply use the array's .length property, and supply an dummy object for this out param. For example: |getAllLogins({})|
logins: An array of nsILoginInfo objects.

PRBool getLoginSavingEnabled ( AString host )

Check to see if saving logins has been disabled for a host.

Arguments:
host: The hostname to check. This argument should be in the origin URL format, without a pathname. For example: "http://foo.com".

void modifyLogin ( nsILoginInfo oldLogin , nsILoginInfo newLogin )

Modify an existing login in the login manager.

Arguments:
oldLogin
newLogin

void removeAllLogins ( )

Remove all logins known to login manager.

The browser sanitization feature allows the user to clear any stored passwords. This interface allows that to be done without getting each login first (which might require knowing the master password).


void removeLogin ( nsILoginInfo login )

Remove a login from the login manager.

Arguments:
login: The login to be removed.

void setLoginSavingEnabled ( AString host , PRBool isEnabled )

Disable (or enable) storing logins for the specified host. When disabled, the login manager will not prompt to store logins for that host. Existing logins are not affected.

Arguments:
host: The hostname to set. This argument should be in the origin URL format, without a pathname. For example: "http://foo.com".
isEnabled: Specify if saving logins should be enabled (true) or disabled (false)

Reference documentation is generated from Mozilla's source.