Added remove account function to config manager.
This commit is contained in:
parent
9b4a2d4ef9
commit
8d682b15b3
@ -194,6 +194,31 @@ exports.addAuthAccount = function(uuid, accessToken, username, displayName){
|
|||||||
return config.authenticationDatabase[uuid]
|
return config.authenticationDatabase[uuid]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove an authenticated account from the database. If the account
|
||||||
|
* was also the selected account, a new one will be selected. If there
|
||||||
|
* are no accounts, the selected account will be null.
|
||||||
|
*
|
||||||
|
* @param {string} uuid The uuid of the authenticated account.
|
||||||
|
*
|
||||||
|
* @returns {boolean} True if the account was removed, false if it never existed.
|
||||||
|
*/
|
||||||
|
exports.removeAuthAccount = function(uuid){
|
||||||
|
if(config.authenticationDatabase[uuid] != null){
|
||||||
|
delete config.authenticationDatabase[uuid]
|
||||||
|
if(config.selectedAccount === uuid){
|
||||||
|
const keys = Object.keys(config.authenticationDatabase)
|
||||||
|
if(keys.length > 0){
|
||||||
|
config.selectedAccount = keys[0]
|
||||||
|
} else {
|
||||||
|
config.selectedAccount = null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the currently selected authenticated account.
|
* Get the currently selected authenticated account.
|
||||||
*
|
*
|
||||||
|
@ -67,9 +67,7 @@
|
|||||||
"perMachine": true,
|
"perMachine": true,
|
||||||
"allowElevation": true,
|
"allowElevation": true,
|
||||||
"installerIcon": "build/icon.ico",
|
"installerIcon": "build/icon.ico",
|
||||||
"uninstallerIcon": "build/icon.ico",
|
"uninstallerIcon": "build/icon.ico"
|
||||||
"installerHeader": "build/icon.ico",
|
|
||||||
"installerHeaderIcon": "build/icon.ico"
|
|
||||||
},
|
},
|
||||||
"mac": {
|
"mac": {
|
||||||
"target": "dmg",
|
"target": "dmg",
|
||||||
|
Loading…
Reference in New Issue
Block a user