ConfigController

ConfigController

This class handles the loading/saving of custom password configurations.

There are 2 ways of loading/saving:

  • the origin of this class: using a base64encoded uri
  • importing and exporting a JSON file

Constructor

new ConfigController(model, view, settingsController)

Description:
  • The default class constructor

Source:
Parameters:
Name Type Description
model XKPasswd

reference to PasswordModel

view ConfigView

reference to ConfigView

settingsController SettingsController

reference to SettingsController

Methods

copyUrl(url)

Description:
  • Copy the parameter to the clipboard

Source:
Parameters:
Name Type Description
url string

the url to be copied

exportSettings() → {string}

Description:
  • Convert the settings to a JSON object

Source:
Returns:
  • the JSON version of the settings
Type
string

fromUrl(url) → {Object}

Description:
  • Convert an url into a settings object for further processing Return an empty object if there is no parameter in the url.

Source:
Parameters:
Name Type Description
url

the URL from the window.location or from the configUrl

Returns:
  • empty object if something went wrong, or settings object
Type
Object

importSettings(settings)

Description:
  • Import the settings from the uploaded file

Source:
Parameters:
Name Type Description
settings Object

the object containing the uploaded settings

loadFromUrl(url) → {string}

Description:
  • Loads the settings from a URL and store them in the model, and returns the name of the preset if specified.

Source:
Parameters:
Name Type Description
url string

The URL to try to extract the settings from

Returns:
  • The name of the preset or CUSTOM if custom URL.
Type
string

toUrl(settings) → {string}

Description:
  • Return a URL string with the encoded settings string

Source:
Parameters:
Name Type Description
settings Object

The settings to encode

Returns:
  • The URL as string
Type
string
Description:
  • Update the configUrl content

Source:
Parameters:
Name Type Default Description
settings object

configuration to convert to a URL

preset string null

(Optional) The name of the preset